[#232] Use contract to get container info #234
Labels
No labels
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-http-gw#234
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "nzinkevich/frostfs-http-gw:feature/get_cnr_from_contract"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Signed-off-by: Nikita Zinkevich n.zinkevich@yadro.com
[#XX] Use contract to get container infoto [#232] Use contract to get container infobe8cfb47bf
to7c1fa45ac7
7c1fa45ac7
toc84b7aa27c
@ -200,0 +201,4 @@
contracts:
container:
# Container contract hash (LE) or name in NNS.
name: container.frostfs
We should mention this in
docs/gate-configuration.md
@ -12,0 +15,4 @@
Owner user.ID
Created time.Time
LocationConstraint string
ObjectLockEnabled bool
Actually these 4 fields are not used. Let's add them later (if needed)
@ -0,0 +21,4 @@
)
func (h *Handler) containerInfo(ctx context.Context, cnrID cid.ID) (*data.BucketInfo, error) {
var (
We can write just (considering previous comment)
@ -0,0 +34,4 @@
res, err = h.cnrContract.GetContainerByID(cnrID)
if err != nil {
if strings.Contains(err.Error(), containerContract.NotFoundError) {
Let's make
GetContainerByID
return ErrContainerNotFound.And don't handle any special here
@ -0,0 +68,4 @@
return nil, fmt.Errorf("get namespace: %w", err)
}
zone := h.config.FormContainerZone(ns)
if zone != info.Zone {
I'm not sure if we need this. We can access raw containers (not bucket) via http-gw too. It seems on that containers check will be failed. We don't want that
@ -0,0 +1,72 @@
package container
It's better to move this file to
service/contracts/container
dirNow its path is
service/contracts/frostfs/container
. It seemsfrostfs
is redundant because we have all contracts in frostfs@ -0,0 +25,4 @@
}
func New(cfg Config) (*Client, error) {
contractHash, err := frostfsutil.ResolveContractHash(cfg.Contract, cfg.RPCAddress)
Can we accept resolving hash as field in
Config
struct? To avoid duplicating inRPCAddress
andRPCClient
c84b7aa27c
to39f2fc4064
39f2fc4064
tob6002c633a
b6002c633a
to3f12b85a2d
3f12b85a2d
to34e986ba91
@ -409,3 +420,3 @@
namespaces := s.defaultNamespaces
s.mu.RUnlock()
if slices.Contains(namespaces, ns) {
if len(ns) == 0 || slices.Contains(namespaces, ns) {
Why do we need this?
To handle empty namespace header as
root
rather than custom nsBy default we have this
v.SetDefault(cfgResolveDefaultNamespaces, []string{"", "root"})
@ -0,0 +47,4 @@
func (c *Client) GetContainerByID(cnrID cid.ID) (*container.Container, error) {
items, err := c.contract.Get(cnrID[:])
if err != nil {
return nil, handler.ErrContainerNotFound
We should not always return
handler.ErrContainerNotFound
.We need something:
34e986ba91
tof2b3c50a69
LGTM, but see comment #234 (comment)
f2b3c50a69
to58a5b34af0
New commits pushed, approval review dismissed automatically according to repository settings
58a5b34af0
to904576bb70
@ -130,0 +130,4 @@
EmptyAccessControlRequestMethodHeader = "empty Access-Control-Request-Method request header"
CORSRuleWasNotMatched = "cors rule was not matched"
CouldntCacheCors = "couldn't cache cors"
CouldNotParseContainerObjectLockEnabledAttribute = "could not parse container object lock enabled attribute"
Seems to be unused and the next one too
904576bb70
to96a22d98f2
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings