forked from TrueCloudLab/frostfs-api-go
Compare commits
49 commits
KirillovDe
...
master
Author | SHA1 | Date | |
---|---|---|---|
e9d67aa1b2 | |||
68021b910a | |||
62edd68f47 | |||
8266b31092 | |||
0c67b8fefa | |||
33445c6810 | |||
eba07dee0c | |||
a3e8e0c00c | |||
a3a5046ecc | |||
e9e7901f67 | |||
2aa3ee46e7 | |||
a6e2ab3845 | |||
1cab39337e | |||
63915bb7a5 | |||
d2b7fd3682 | |||
e297616a48 | |||
ff6d8db741 | |||
bd44a3f47b | |||
|
d9347a05f0 | ||
b3ccd0166f | |||
5f318f0b75 | |||
3b938873cc | |||
84dc99a045 | |||
dbcd514748 | |||
d9c5b9c90e | |||
a4e361a2e6 | |||
488ee50f9e | |||
816628d37d | |||
3a7280968b | |||
|
e6522d62a8 | ||
|
e022a2b831 | ||
29a562da0e | |||
ee64c0cd51 | |||
9dc3753467 | |||
8009022a20 | |||
cd2e46a17c | |||
c46cd37f71 | |||
ec0d0274fa | |||
73fde0e37c | |||
611f73ad0f | |||
e073c996fc | |||
d005bf0393 | |||
63eb4dc3ea | |||
3f7cb1b5ef | |||
bd67469f43 | |||
3af7645abf | |||
5faee63f60 | |||
f69d2ad83c | |||
196241c4e7 |
185 changed files with 1159 additions and 4613 deletions
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
* @TrueCloudLab/storage-core @TrueCloudLab/storage-services @TrueCloudLab/committers
|
45
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
45
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: community, triage, bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--- Provide a general summary of the issue in the Title above -->
|
||||
|
||||
## Expected Behavior
|
||||
<!--- If you're describing a bug, tell us what should happen -->
|
||||
<!--- If you're suggesting a change/improvement, tell us how it should work -->
|
||||
|
||||
## Current Behavior
|
||||
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
|
||||
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
|
||||
|
||||
## Possible Solution
|
||||
<!--- Not obligatory -->
|
||||
<!--- If no reason/fix/additions for the bug can be suggested, -->
|
||||
<!--- uncomment the following phrase: -->
|
||||
|
||||
<!--- No fix can be suggested by a QA engineer. Further solutions shall be up to developers. -->
|
||||
|
||||
## Steps to Reproduce (for bugs)
|
||||
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
|
||||
<!--- reproduce this bug. -->
|
||||
|
||||
1.
|
||||
|
||||
## Context
|
||||
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
||||
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
|
||||
|
||||
## Regression
|
||||
<!-- Is this issue a regression? (Yes / No) -->
|
||||
<!-- If Yes, optionally please include version or commit id or PR# that caused this regression, if you have these details. -->
|
||||
|
||||
## Your Environment
|
||||
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
||||
* Version used:
|
||||
* Server setup and configuration:
|
||||
* Operating System and version (`uname -a`):
|
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
blank_issues_enabled: false
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
|
@ -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.
|
||||
<!--- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
|
||||
|
||||
## Describe the solution you'd like
|
||||
<!--- A clear and concise description of what you want to happen. -->
|
||||
|
||||
## Describe alternatives you've considered
|
||||
<!--- A clear and concise description of any alternative solutions or features you've considered. -->
|
||||
|
||||
## Additional context
|
||||
<!--- Add any other context or screenshots about the feature request here. -->
|
70
.github/logo.svg
vendored
70
.github/logo.svg
vendored
|
@ -1,70 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Слой_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 184.2 51.8" style="enable-background:new 0 0 184.2 51.8;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{display:none;}
|
||||
.st1{display:inline;}
|
||||
.st2{fill:#01E397;}
|
||||
.st3{display:inline;fill:#010032;}
|
||||
.st4{display:inline;fill:#00E599;}
|
||||
.st5{display:inline;fill:#00AF92;}
|
||||
.st6{fill:#00C3E5;}
|
||||
</style>
|
||||
<g id="Layer_2">
|
||||
<g id="Layer_1-2" class="st0">
|
||||
<g class="st1">
|
||||
<path class="st2" d="M146.6,18.3v7.2h10.9V29h-10.9v10.7h-4V14.8h18v3.5H146.6z"/>
|
||||
<path class="st2" d="M180,15.7c1.7,0.9,3,2.2,4,3.8l-3,2.7c-0.6-1.3-1.5-2.4-2.6-3.3c-1.3-0.7-2.8-1-4.3-1
|
||||
c-1.4-0.1-2.8,0.3-4,1.1c-0.9,0.5-1.5,1.5-1.4,2.6c0,1,0.5,1.9,1.4,2.4c1.5,0.8,3.2,1.3,4.9,1.5c1.9,0.3,3.7,0.8,5.4,1.6
|
||||
c1.2,0.5,2.2,1.3,2.9,2.3c0.6,1,1,2.2,0.9,3.4c0,1.4-0.5,2.7-1.3,3.8c-0.9,1.2-2.1,2.1-3.5,2.6c-1.7,0.6-3.4,0.9-5.2,0.8
|
||||
c-5,0-8.6-1.6-10.7-5l2.9-2.8c0.7,1.4,1.8,2.5,3.1,3.3c1.5,0.7,3.1,1.1,4.7,1c1.5,0.1,2.9-0.2,4.2-0.9c0.9-0.5,1.5-1.5,1.5-2.6
|
||||
c0-0.9-0.5-1.8-1.3-2.2c-1.5-0.7-3.1-1.2-4.8-1.5c-1.9-0.3-3.7-0.8-5.5-1.5c-1.2-0.5-2.2-1.4-3-2.4c-0.6-1-1-2.2-0.9-3.4
|
||||
c0-1.4,0.4-2.7,1.2-3.8c0.8-1.2,2-2.2,3.3-2.8c1.6-0.7,3.4-1.1,5.2-1C176.1,14.3,178.2,14.8,180,15.7z"/>
|
||||
</g>
|
||||
<path class="st3" d="M73.3,16.3c1.9,1.9,2.9,4.5,2.7,7.1v15.9h-4V24.8c0-2.6-0.5-4.5-1.6-5.7c-1.2-1.2-2.8-1.8-4.5-1.7
|
||||
c-1.3,0-2.5,0.3-3.7,0.8c-1.2,0.7-2.2,1.7-2.9,2.9c-0.8,1.5-1.1,3.2-1.1,4.9v13.3h-4V15.1l3.6,1.5v1.7c0.8-1.5,2.1-2.6,3.6-3.3
|
||||
c1.5-0.8,3.2-1.2,4.9-1.1C68.9,13.8,71.3,14.7,73.3,16.3z"/>
|
||||
<path class="st3" d="M104.4,28.3H85.6c0.1,2.2,1,4.3,2.5,5.9c1.5,1.4,3.5,2.2,5.6,2.1c1.6,0.1,3.2-0.2,4.6-0.9
|
||||
c1.1-0.6,2-1.6,2.5-2.8l3.3,1.8c-0.9,1.7-2.3,3.1-4,4c-2,1-4.2,1.5-6.4,1.4c-3.7,0-6.7-1.1-8.8-3.4s-3.2-5.5-3.2-9.6s1-7.2,3-9.5
|
||||
s5-3.4,8.7-3.4c2.1-0.1,4.2,0.5,6.1,1.5c1.6,1,3,2.5,3.8,4.2c0.9,1.8,1.3,3.9,1.3,5.9C104.6,26.4,104.6,27.4,104.4,28.3z
|
||||
M88.1,19.3c-1.4,1.5-2.2,3.4-2.4,5.5h15.1c-0.2-2-1-3.9-2.3-5.5c-1.4-1.3-3.2-2-5.1-1.9C91.5,17.3,89.6,18,88.1,19.3z"/>
|
||||
<path class="st3" d="M131,17.3c2.2,2.3,3.2,5.5,3.2,9.5s-1,7.3-3.2,9.6s-5.1,3.4-8.8,3.4s-6.7-1.1-8.9-3.4s-3.2-5.5-3.2-9.6
|
||||
s1.1-7.2,3.2-9.5s5.1-3.4,8.9-3.4S128.9,15,131,17.3z M116.2,19.9c-1.5,2-2.2,4.4-2.1,6.9c-0.2,2.5,0.6,5,2.1,7
|
||||
c1.5,1.7,3.7,2.7,6,2.6c2.3,0.1,4.4-0.9,5.9-2.6c1.5-2,2.3-4.5,2.1-7c0.1-2.5-0.6-4.9-2.1-6.9c-1.5-1.7-3.6-2.7-5.9-2.6
|
||||
C119.9,17.2,117.7,18.2,116.2,19.9z"/>
|
||||
<polygon class="st4" points="0,9.1 0,43.7 22.5,51.8 22.5,16.9 46.8,7.9 24.8,0 "/>
|
||||
<polygon class="st5" points="24.3,17.9 24.3,36.8 46.8,44.9 46.8,9.6 "/>
|
||||
</g>
|
||||
<g>
|
||||
<g>
|
||||
<path class="st6" d="M41.6,17.5H28.2v6.9h10.4v3.3H28.2v10.2h-3.9V14.2h17.2V17.5z"/>
|
||||
<path class="st6" d="M45.8,37.9v-18h3.3l0.4,3.2c0.5-1.2,1.2-2.1,2.1-2.7c0.9-0.6,2.1-0.9,3.5-0.9c0.4,0,0.7,0,1.1,0.1
|
||||
c0.4,0.1,0.7,0.2,0.9,0.3l-0.5,3.4c-0.3-0.1-0.6-0.2-0.9-0.2C55.4,23,54.9,23,54.4,23c-0.7,0-1.5,0.2-2.2,0.6
|
||||
c-0.7,0.4-1.3,1-1.8,1.8s-0.7,1.8-0.7,3v9.5H45.8z"/>
|
||||
<path class="st6" d="M68.6,19.6c1.8,0,3.3,0.4,4.6,1.1c1.3,0.7,2.4,1.8,3.1,3.2s1.1,3.1,1.1,5c0,1.9-0.4,3.6-1.1,5
|
||||
c-0.8,1.4-1.8,2.5-3.1,3.2c-1.3,0.7-2.9,1.1-4.6,1.1s-3.3-0.4-4.6-1.1c-1.3-0.7-2.4-1.8-3.2-3.2c-0.8-1.4-1.2-3.1-1.2-5
|
||||
c0-1.9,0.4-3.6,1.2-5s1.8-2.5,3.2-3.2C65.3,19.9,66.8,19.6,68.6,19.6z M68.6,22.6c-1.1,0-2,0.2-2.8,0.7c-0.8,0.5-1.3,1.2-1.7,2.1
|
||||
s-0.6,2.1-0.6,3.5c0,1.3,0.2,2.5,0.6,3.4s1,1.7,1.7,2.2s1.7,0.7,2.8,0.7c1.1,0,2-0.2,2.7-0.7c0.7-0.5,1.3-1.2,1.7-2.2
|
||||
s0.6-2.1,0.6-3.4c0-1.4-0.2-2.5-0.6-3.5s-1-1.6-1.7-2.1C70.6,22.8,69.6,22.6,68.6,22.6z"/>
|
||||
<path class="st6" d="M89.2,38.3c-1.8,0-3.4-0.3-4.9-1c-1.5-0.7-2.7-1.7-3.5-3l2.7-2.3c0.5,1,1.3,1.8,2.3,2.4
|
||||
c1,0.6,2.2,0.9,3.6,0.9c1.1,0,2-0.2,2.6-0.6c0.6-0.4,1-0.9,1-1.6c0-0.5-0.2-0.9-0.5-1.2s-0.9-0.6-1.7-0.8l-3.8-0.8
|
||||
c-1.9-0.4-3.3-1-4.1-1.9c-0.8-0.9-1.2-1.9-1.2-3.3c0-1,0.3-1.9,0.9-2.7c0.6-0.8,1.4-1.5,2.5-2s2.5-0.8,4-0.8c1.8,0,3.3,0.3,4.6,1
|
||||
c1.3,0.6,2.2,1.5,2.9,2.7l-2.7,2.2c-0.5-1-1.1-1.7-2-2.1c-0.9-0.5-1.8-0.7-2.8-0.7c-0.8,0-1.4,0.1-2,0.3c-0.6,0.2-1,0.5-1.3,0.8
|
||||
c-0.3,0.3-0.4,0.7-0.4,1.2c0,0.5,0.2,0.9,0.5,1.3s1,0.6,1.9,0.8l4.1,0.9c1.7,0.3,2.9,0.9,3.7,1.7c0.7,0.8,1.1,1.8,1.1,2.9
|
||||
c0,1.2-0.3,2.2-0.9,3c-0.6,0.9-1.5,1.6-2.6,2C92.1,38.1,90.7,38.3,89.2,38.3z"/>
|
||||
<path class="st6" d="M112.8,19.9v3H99.3v-3H112.8z M106.6,14.6v17.9c0,0.9,0.2,1.5,0.7,1.9c0.5,0.4,1.1,0.6,1.9,0.6
|
||||
c0.6,0,1.2-0.1,1.7-0.3c0.5-0.2,0.9-0.5,1.3-0.8l0.9,2.8c-0.6,0.5-1.2,0.9-2,1.1c-0.8,0.3-1.7,0.4-2.7,0.4c-1,0-2-0.2-2.8-0.5
|
||||
s-1.5-0.9-2-1.6c-0.5-0.8-0.7-1.7-0.8-3V15.7L106.6,14.6z"/>
|
||||
<path d="M137.9,17.5h-13.3v6.9h10.4v3.3h-10.4v10.2h-3.9V14.2h17.2V17.5z"/>
|
||||
<path d="M150.9,13.8c2.1,0,4,0.4,5.5,1.2c1.6,0.8,2.9,2,4,3.5l-2.6,2.5c-0.9-1.4-1.9-2.4-3.1-3c-1.1-0.6-2.5-0.9-4-0.9
|
||||
c-1.2,0-2.1,0.2-2.8,0.5c-0.7,0.3-1.3,0.7-1.6,1.2c-0.3,0.5-0.5,1.1-0.5,1.7c0,0.7,0.3,1.4,0.8,1.9c0.5,0.6,1.5,1,2.9,1.3
|
||||
l4.8,1.1c2.3,0.5,3.9,1.3,4.9,2.3c1,1,1.4,2.3,1.4,3.9c0,1.5-0.4,2.7-1.2,3.8c-0.8,1.1-1.9,1.9-3.3,2.5s-3.1,0.9-5,0.9
|
||||
c-1.7,0-3.2-0.2-4.5-0.6c-1.3-0.4-2.5-1-3.5-1.8c-1-0.7-1.8-1.6-2.5-2.6l2.7-2.7c0.5,0.8,1.1,1.6,1.9,2.2
|
||||
c0.8,0.7,1.7,1.2,2.7,1.5c1,0.4,2.2,0.5,3.4,0.5c1.1,0,2.1-0.1,2.9-0.4c0.8-0.3,1.4-0.7,1.8-1.2c0.4-0.5,0.6-1.1,0.6-1.9
|
||||
c0-0.7-0.2-1.3-0.7-1.8c-0.5-0.5-1.3-0.9-2.6-1.2l-5.2-1.2c-1.4-0.3-2.6-0.8-3.6-1.3c-0.9-0.6-1.6-1.3-2.1-2.1s-0.7-1.8-0.7-2.8
|
||||
c0-1.3,0.4-2.6,1.1-3.7c0.7-1.1,1.8-2,3.2-2.6C147.3,14.1,148.9,13.8,150.9,13.8z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 5.5 KiB |
21
.github/workflows/dco.yml
vendored
21
.github/workflows/dco.yml
vendored
|
@ -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 }}
|
64
.github/workflows/go.yml
vendored
64
.github/workflows/go.yml
vendored
|
@ -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
|
10
.gitlint
Normal file
10
.gitlint
Normal file
|
@ -0,0 +1,10 @@
|
|||
[general]
|
||||
fail-without-commits=true
|
||||
contrib=CC1
|
||||
|
||||
[title-match-regex]
|
||||
regex=^\[\#[0-9Xx]+\]\s
|
||||
|
||||
[ignore-by-title]
|
||||
regex=^Release(.*)
|
||||
ignore=title-match-regex
|
|
@ -4,14 +4,14 @@
|
|||
# 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
|
||||
|
||||
skip-files:
|
||||
- (^|.*/)grpc/(.*)
|
||||
|
||||
|
||||
# output configuration options
|
||||
output:
|
||||
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
|
||||
|
@ -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
|
||||
|
||||
|
@ -64,4 +81,4 @@ issues:
|
|||
|
||||
- linters: # ignore SA6002 since we use pool of []byte, however we can switch to *bytes.Buffer
|
||||
- staticcheck
|
||||
text: "SA6002:"
|
||||
text: "SA6002:"
|
||||
|
|
30
.pre-commit-config.yaml
Normal file
30
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,30 @@
|
|||
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$"
|
||||
|
||||
- repo: https://github.com/golangci/golangci-lint
|
||||
rev: v1.51.2
|
||||
hooks:
|
||||
- id: golangci-lint
|
||||
|
||||
- repo: https://github.com/jorisroovers/gitlint
|
||||
rev: v0.18.0
|
||||
hooks:
|
||||
- id: gitlint
|
||||
stages: [commit-msg]
|
856
CHANGELOG.md
856
CHANGELOG.md
|
@ -3,854 +3,36 @@
|
|||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
### Fixed
|
||||
### Changed
|
||||
### Updated
|
||||
|
||||
## [2.14.0] - 2022-10-17 - Anmado (안마도, 鞍馬島)
|
||||
|
||||
### Added
|
||||
- Maintenance status and node state (#415)
|
||||
- `NetmapSnapshot` RPC (#418)
|
||||
- Add impersonate flag to bearer token (#17)
|
||||
|
||||
### 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
|
||||
- `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).
|
||||
- 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`
|
||||
|
||||
- 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 (무의도, 舞衣島)
|
||||
## 2.15.0 - 2023-04-11
|
||||
|
||||
### Added
|
||||
- Basic tracing support (#12)
|
||||
- Optimize signature checking (#3)
|
||||
|
||||
- `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.
|
||||
Initial public release.
|
||||
|
||||
### Fixed
|
||||
## Older versions
|
||||
|
||||
- Added leading slash to format of gRPC method names.
|
||||
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.
|
||||
|
||||
### 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
|
||||
|
|
0
Makefile
Normal file → Executable file
0
Makefile
Normal file → Executable file
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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.
|
||||
|
|
BIN
accounting/grpc/service.pb.go
generated
BIN
accounting/grpc/service.pb.go
generated
Binary file not shown.
BIN
accounting/grpc/service_grpc.pb.go
generated
BIN
accounting/grpc/service_grpc.pb.go
generated
Binary file not shown.
BIN
accounting/grpc/types.pb.go
generated
BIN
accounting/grpc/types.pb.go
generated
Binary file not shown.
|
@ -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) {
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -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
|
||||
|
|
BIN
acl/grpc/types.pb.go
generated
BIN
acl/grpc/types.pb.go
generated
Binary file not shown.
|
@ -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) {
|
||||
|
|
|
@ -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 (
|
||||
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 {
|
||||
|
|
16
acl/types.go
16
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.
|
||||
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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.
|
||||
|
|
BIN
audit/grpc/types.pb.go
generated
BIN
audit/grpc/types.pb.go
generated
Binary file not shown.
|
@ -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) {
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package container
|
||||
|
||||
// SysAttributePrefix is a prefix of key to system attribute.
|
||||
const SysAttributePrefix = "__NEOFS__"
|
||||
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"
|
||||
|
||||
|
@ -17,6 +14,24 @@ const (
|
|||
SysAttributeHomomorphicHashing = SysAttributePrefix + "DISABLE_HOMOMORPHIC_HASHING"
|
||||
)
|
||||
|
||||
// SysAttributePrefixNeoFS is a prefix of key to system attribute.
|
||||
// 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.
|
||||
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"
|
||||
)
|
||||
|
||||
// SysAttributeZoneDefault is a default value for SysAttributeZone attribute.
|
||||
const SysAttributeZoneDefault = "container"
|
||||
|
||||
|
@ -33,7 +48,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 +65,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
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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.
|
||||
|
|
BIN
container/grpc/service.pb.go
generated
BIN
container/grpc/service.pb.go
generated
Binary file not shown.
BIN
container/grpc/service_grpc.pb.go
generated
BIN
container/grpc/service_grpc.pb.go
generated
Binary file not shown.
|
@ -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.
|
||||
|
|
BIN
container/grpc/types.pb.go
generated
BIN
container/grpc/types.pb.go
generated
Binary file not shown.
|
@ -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) {
|
||||
|
|
|
@ -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 (
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
31
go.mod
31
go.mod
|
@ -1,23 +1,26 @@
|
|||
module github.com/TrueCloudLab/frostfs-api-go/v2
|
||||
module git.frostfs.info/TrueCloudLab/frostfs-api-go/v2
|
||||
|
||||
go 1.17
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
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
|
||||
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
|
||||
google.golang.org/protobuf v1.30.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
|
||||
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.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
|
||||
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
|
||||
)
|
||||
|
|
159
go.sum
159
go.sum
|
@ -1,139 +1,48 @@
|
|||
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=
|
||||
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-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=
|
||||
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/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.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=
|
||||
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.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=
|
||||
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/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.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/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.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/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
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=
|
||||
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
||||
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/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-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-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=
|
||||
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-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/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/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=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
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=
|
||||
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/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/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.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/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.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
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=
|
||||
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.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/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/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=
|
||||
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=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
|
|
@ -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) {
|
||||
|
|
BIN
lock/grpc/types.pb.go
generated
BIN
lock/grpc/types.pb.go
generated
Binary file not shown.
|
@ -1,225 +0,0 @@
|
|||
package netmap
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/TrueCloudLab/frostfs-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
|
||||
}
|
||||
|
||||
// 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 `__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.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) {
|
||||
// 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
|
||||
}
|
|
@ -1,361 +0,0 @@
|
|||
package netmap_test
|
||||
|
||||
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"
|
||||
"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 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)
|
||||
})
|
||||
}
|
|
@ -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 {
|
||||
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
BIN
netmap/grpc/service.pb.go
generated
BIN
netmap/grpc/service.pb.go
generated
Binary file not shown.
BIN
netmap/grpc/service_grpc.pb.go
generated
BIN
netmap/grpc/service_grpc.pb.go
generated
Binary file not shown.
|
@ -1,7 +1,5 @@
|
|||
package netmap
|
||||
|
||||
import refs "github.com/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
|
||||
|
|
BIN
netmap/grpc/types.pb.go
generated
BIN
netmap/grpc/types.pb.go
generated
Binary file not shown.
|
@ -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) {
|
||||
|
|
|
@ -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 (
|
||||
|
@ -26,7 +26,7 @@ const (
|
|||
backupPolicyField = 2
|
||||
selectorsPolicyField = 3
|
||||
filtersPolicyField = 4
|
||||
subnetIDPolicyField = 5
|
||||
uniquePolicyField = 5
|
||||
|
||||
keyAttributeField = 1
|
||||
valueAttributeField = 2
|
||||
|
@ -167,7 +167,7 @@ func (p *PlacementPolicy) StableMarshal(buf []byte) []byte {
|
|||
offset += protoutil.NestedStructureMarshal(filtersPolicyField, buf[offset:], &p.filters[i])
|
||||
}
|
||||
|
||||
protoutil.NestedStructureMarshal(subnetIDPolicyField, buf[offset:], p.subnetID)
|
||||
offset += protoutil.BoolMarshal(uniquePolicyField, buf[offset:], p.unique)
|
||||
|
||||
return buf
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ func (p *PlacementPolicy) StableSize() (size int) {
|
|||
size += protoutil.NestedStructureSize(filtersPolicyField, &p.filters[i])
|
||||
}
|
||||
|
||||
size += protoutil.NestedStructureSize(subnetIDPolicyField, p.subnetID)
|
||||
size += protoutil.BoolSize(uniquePolicyField, p.unique)
|
||||
|
||||
return size
|
||||
}
|
||||
|
@ -280,7 +280,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
|
||||
}
|
||||
|
||||
|
@ -437,7 +437,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
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -145,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
|
||||
|
@ -226,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
|
||||
|
|
|
@ -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 {
|
||||
|
@ -59,7 +59,7 @@ type PlacementPolicy struct {
|
|||
backupFactor uint32
|
||||
selectors []Selector
|
||||
filters []Filter
|
||||
subnetID *refs.SubnetID
|
||||
unique bool
|
||||
}
|
||||
|
||||
// Attribute of storage node.
|
||||
|
@ -107,6 +107,7 @@ const (
|
|||
LE
|
||||
OR
|
||||
AND
|
||||
NOT
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -258,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
|
||||
|
@ -302,14 +314,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
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
)
|
||||
|
||||
// SysAttributePrefix is a prefix of key to system attribute.
|
||||
const SysAttributePrefix = "__NEOFS__"
|
||||
const SysAttributePrefix = "__SYSTEM__"
|
||||
|
||||
const (
|
||||
// SysAttributeUploadID marks smaller parts of a split bigger object.
|
||||
|
@ -25,6 +25,30 @@ const (
|
|||
SysAttributeTickTopic = SysAttributePrefix + "TICK_TOPIC"
|
||||
)
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// NotificationInfo groups information about object notification
|
||||
// that can be written to object.
|
||||
//
|
||||
|
@ -81,10 +105,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 +165,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 +174,7 @@ func GetNotificationInfo(o *Object) (*NotificationInfo, error) {
|
|||
ni.SetEpoch(epoch)
|
||||
|
||||
foundEpoch = true
|
||||
case SysAttributeTickTopic:
|
||||
case SysAttributeTickTopic, SysAttributeTickTopicNeoFS:
|
||||
ni.SetTopic(attr.GetValue())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
|
BIN
object/grpc/service.pb.go
generated
BIN
object/grpc/service.pb.go
generated
Binary file not shown.
BIN
object/grpc/service_grpc.pb.go
generated
BIN
object/grpc/service_grpc.pb.go
generated
Binary file not shown.
BIN
object/grpc/status.pb.go
generated
BIN
object/grpc/status.pb.go
generated
Binary file not shown.
|
@ -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.
|
||||
|
|
BIN
object/grpc/types.pb.go
generated
BIN
object/grpc/types.pb.go
generated
Binary file not shown.
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
|
@ -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 (
|
||||
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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))
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
BIN
refs/grpc/types.pb.go
generated
BIN
refs/grpc/types.pb.go
generated
Binary file not shown.
|
@ -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) {
|
||||
|
|
|
@ -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 (
|
||||
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
@ -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) },
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue