Ambiguous chain listing in policy contract #67

Closed
opened 2024-01-11 10:38:43 +00:00 by aarifullin · 1 comment
Member

Policy contract provides a method to list chains: ListChains.

The listing is performed by a given prefix, not whole name.
First, chains for <namespace>* are listed, then they're listed for <container>*. That means if we invoke the method with empty strings, we get all chains stored in the storage.
At the same time, this leads to ambiguous situation when we mean the empty namespace is root. Thus, intending to get root namespace chains, we will get all chains. Moreover, chains themselves do not refer to which target they are belonged -> we cannot determine does a chain is recieved for root namespace or other one.

Need to discuss possible solutions, before solving the issue.

Policy contract provides a method to list chains: [ListChains](https://git.frostfs.info/TrueCloudLab/frostfs-contract/src/branch/master/policy/policy_contract.go#L124). The listing is performed by a given _prefix_, not whole name. First, chains for `<namespace>*` are listed, then they're listed for `<container>*`. That means if we invoke the method with empty strings, we get _all_ chains stored in the storage. At the same time, this leads to ambiguous situation when we **mean** the empty namespace is _root_. Thus, intending to get root namespace chains, we will get all chains. Moreover, chains themselves do not refer to which target they are belonged -> we cannot determine does a chain is recieved for _root_ namespace or other one. Need to discuss possible solutions, before solving the issue.
aarifullin added the
discussion
label 2024-01-11 10:38:43 +00:00
Author
Member

The problem is no longer relevant after #71.

ListChainsByPrefix('n', "", ""): if value of the second param is "", then it stands for root namespace only, because "" is mapped to a number . So, the invocation lists all chains within root namespace

ListChainsByPrefix('c', "", ""): this is barely may be use-case, because container ID cannot be empty

The problem is no longer relevant after [#71](https://git.frostfs.info/TrueCloudLab/frostfs-contract/pulls/71). `ListChainsByPrefix('n', "", "")`: if value of the second param is `""`, then it stands for root namespace **only**, because `""` is mapped to a number . So, the invocation lists all chains within root namespace `ListChainsByPrefix('c', "", "")`: this is barely may be use-case, because container ID cannot be empty
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-contract#67
No description provided.