nns: Allow 'Register' register TLD from nested domains #117
No reviewers
TrueCloudLab/storage-core-developers
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 project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-contract#117
Loading…
Reference in a new issue
No description provided.
Delete branch "achuprov/frostfs-contract:feat/allow_register_nested_domain"
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?
Allow registration of
TLD
domains when callingaa.bb.cc
Signed-off-by: Alexander Chuprov a.chuprov@yadro.com
d449e0adf1
to833326318d
833326318d
to2508ec4c17
2508ec4c17
to81853bd242
7b59530eaf
tob004b05b17
WIP: nns: Allow 'Register' register TLD from nested domainsto nns: Allow 'Register' register TLD from nested domains@ -16,0 +12,4 @@
| 0x21 + tokenKey | ByteArray | serialized NameState struct |
| 0x22 + tokenKey + Hash160(tokenName) | Hash160 | container contract hash |
| 0x23 + tokenKey + Hash160(tokenName) | string | global domain flag |
| 0x24 + tokenKey | int | number of subdomains for the TLD domain |
If I register
bb.com
and thenaa.bb.com
, will it be equal to 2?I.e. TLD is NOT included and lower level domains are taken into account regardless of what zone they belong to?
No, 3. The number of domains in the zone is counted (including the zone). Clarified the wording
@ -277,7 +279,6 @@ func getGlobalDomain(ctx storage.Context, domain string) string {
// extractCnametgt returns the value of the Cnametgt TXT record.
func extractCnametgt(ctx storage.Context, name, domain string) string {
fragments := splitAndCheck(domain)
useless change
fixed
@ -45,2 +45,4 @@
//This is necessary to distinguish it from regular CNAME records.
prefixGlobalDomain byte = 0x23
// prefixCountSubDomains contains information about the number of subdomains for the TLD domain.
// If it is nil, it will definitely be calculated on the first removal
Comment should end with a dot (we have no linter for contracts for other reasons)
@ -326,2 +320,3 @@
return name
continue
}
blank line
fixed
@ -409,2 +413,4 @@
postTransfer(oldOwner, owner, []byte(name), nil)
runtime.Notify("RegisterDomain", name)
countSubDomain := 0
Could you move this to a separate
updateSubdomainCounter
function?The
l == 1
condition could be aisTLD
parameter.Would be easier to read.
@ -578,3 +594,3 @@
}
func deleteDomain(ctx storage.Context, name string) {
func restoreCountSubDomains(ctx storage.Context, name string) int {
What does
restore
mean here?Looks like
countSubdomains()
?@ -588,0 +618,4 @@
countSubDomain = common.FromFixedWidth64(countSubDomainRaw.([]byte))
} else {
countSubDomain = restoreCountSubDomains(ctx, fragments[len(fragments)-1])
storage.Put(ctx, countSubDomainsKey, std.Serialize(common.ToFixedWidth64(countSubDomain)))
@ -609,2 +651,4 @@
storage.Delete(ctx, nsKey)
storage.Delete(ctx, append([]byte{prefixRoot}, []byte(name)...))
isAutoCrated := storage.Get(ctx, autoCreatedPrefix)
crEated
fixed
@ -610,1 +652,4 @@
storage.Delete(ctx, append([]byte{prefixRoot}, []byte(name)...))
isAutoCrated := storage.Get(ctx, autoCreatedPrefix)
if countSubDomain == 1 && isAutoCrated != nil {
isAutoCreated
looks like a leaky abstraction to me, why do we care whether is was autocreated or by hand?If the user has created
aa.bb.cc
, they may not know anything aboutcc
. Therefore, there is a chance of forming garbage zones.b004b05b17
to2947de0d87
2947de0d87
to10ae9bafc1
@ -344,3 +340,2 @@
fragments := splitAndCheck(name)
l := len(fragments)
tldKey := append([]byte{prefixRoot}, []byte(fragments[l-1])...)
isTLD := len(fragments)
is*
is more like a name for boolean variable than an integerfixed
@ -610,1 +638,4 @@
storage.Delete(ctx, append([]byte{prefixRoot}, []byte(name)...))
isAutoCreated := storage.Get(ctx, autoCreatedPrefix)
if countSubDomain == 1 && isAutoCreated != nil {
Could you add
&& isAutoCreated.(bool)
?There would be fewer chances to break in future.
fixed
10ae9bafc1
to85c0a044ef
85c0a044ef
to3f4f8feca7