nns: Add GetDomains #108
No reviewers
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
6 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-contract#108
Loading…
Reference in a new issue
No description provided.
Delete branch "achuprov/frostfs-contract:feat/add_GetSubDomain"
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?
GetDomains
returns a list of existing subdomains. After that, it is possible to retrieve a list of all records usingGetAllRecords
.Signed-off-by: Alexander Chuprov a.chuprov@yadro.com
Semantically, it is more correct to make it possible to receive records of a certain level. In DNS zones, there is no concept of a subdomain as such, there are only records of a certain type. Getting a subdomain at a lower level is just getting records of a zone with a level restriction.
e3a353fa75
toe46ac55b45
nns: Add GetSubDomainsto nns: Add GetDomains@ -205,0 +242,4 @@
"myemail@frostfs.info", refresh, retry, expire, ttl)
c1.Invoke(t, []stackitem.Item{stackitem.NewBuffer([]byte("dom.com")), stackitem.NewBuffer([]byte("globaldomain.com")),
stackitem.NewBuffer([]byte("com.com")), stackitem.NewBuffer([]byte("domik.dom.com"))}, "getDomains", "com")
I wonder why
domik.dom.com
andcom.com
are returned andcom.com.com
andcom.com.com.com
are not?You are right. I've fixed the typo
e46ac55b45
to01a301412d
@ -15,6 +15,7 @@ safemethods:
- "tokens"
- "resolve"
- "roots"
- "getDomains"
wrong file
fixed
01a301412d
to79ee453016
New commits pushed, approval review dismissed automatically according to repository settings
79ee453016
toa5d523b194
@ -1067,0 +1083,4 @@
domainRaw := iterator.Value(it).([]byte)
ns := std.Deserialize(domainRaw).(NameState)
firstSeparatorIndex := std.MemorySearch([]byte(ns.Name), []byte("."))
lastSeparatorIndex := std.MemorySearchLastIndex([]byte(ns.Name), []byte(zone), len(ns.Name))
Can we exploit ordered iteration in order to prune some ranges?
Currently it is a brute-force with filtering, can (will) break with a sufficiently big number of domains.
We use a hash of the domain name to store the
NS
record, so we can't rely on lexicographical order of iteration.func getTokenKey(tokenID []byte) []byte {
return crypto.Ripemd160(tokenID)
}
// getNameState returns domain name state by the specified tokenID.
func getNameState(ctx storage.Context, tokenID []byte) NameState {
tokenKey := getTokenKey(tokenID)
ns := getNameStateWithKey(ctx, tokenKey)
fragments := std.StringSplit(string(tokenID), ".")
checkParentExists(ctx, fragments)
return ns
}
a5d523b194
to743f082d38
It if doesn't allow to return many items (what is the limit btw?), let's not do this now.
We can return an iterator over all domains (it is in NEP-11 standard) and then filter on the client.
Maybe add a new function which iterates over deserialized values, but still, we should return an iterator.
743f082d38
to13c771b038
13c771b038
tobee4c93a56
Contract-level pagination results in an
n^2
complexity, so I suggest we avoid providing deserialized data. Let's return just iterator.duplicates the Tokens method.
Pull request closed