Some work

This commit is contained in:
2026-01-28 16:51:50 -06:00
parent 3f347d8342
commit c84fe6b807
7 changed files with 220 additions and 28 deletions

View File

@@ -56,6 +56,7 @@ type Pds struct {
NSIDs []syntax.NSID
RecordIds []string
nsidToRecordIds map[syntax.NSID][]string
recordIdsToNSID map[string]syntax.NSID
Records map[string]map[string]any
RefreshTime time.Time
@@ -96,6 +97,7 @@ func NewPdsFromDid(id string) (*Pds, error) {
Did: ident.DID,
localPath: carPath,
nsidToRecordIds: make(map[syntax.NSID][]string),
recordIdsToNSID: make(map[string]syntax.NSID),
Records: make(map[string]map[string]any),
RefreshTime: time.Now(),
}
@@ -142,6 +144,7 @@ func (p *Pds) unpack() error {
p.NSIDs = append(p.NSIDs, col)
}
p.nsidToRecordIds[col] = append(p.nsidToRecordIds[col], sRKey)
p.recordIdsToNSID[sRKey] = col
return nil
})
//slices.Sort(p.NSIDs)
@@ -179,4 +182,5 @@ func (p *Pds) List() (map[string]string, error) {
return ret, nil
}
func (p *Pds) GetRecordIdsFor(n syntax.NSID) []string { return p.nsidToRecordIds[n] }
func (p *Pds) GetRecordIdsFor(n syntax.NSID) []string { return p.nsidToRecordIds[n] }
func (p *Pds) GetNSIDForRecordId(rId string) syntax.NSID { return p.recordIdsToNSID[rId] }