Bring herald/db/prefixes.go up to date with new tables #46
Labels
No labels
consider soon
documentation
good first issue
hacktoberfest
help wanted
priority: blocker
priority: high
priority: low
priority: medium
type: bug
type: discussion
type: improvement
type: new feature
type: refactor
type: task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/herald.go#46
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Latest tables in (python) hub:
4845b92248/hub/db/common.py (L50)
Latest tables in herald.go:
8b4b27bdb9/db/prefixes/prefixes.go (L61)
After writing some Pack/Unpack() code for one of the new tables, I'm searching for something that can automate this. Using reflect to make the Pack/Unpack() generic is not a new idea. Found these packages that do it:
https://pkg.go.dev/github.com/lunixbochs/struc
https://pkg.go.dev/github.com/go-restruct/restruct
Performance benchmark from 7 years ago indicated it was 10x slower than manually written code.
https://github.com/lunixbochs/struc#benchmark
The plan is to use generics from go 1.18 for this https://go.dev/blog/why-generics. If we can get performance improvements out of this tangentially to that, it sounds good. We should talk about this in the call.
I have successfully tagged 2 existing structs (EffectiveAmountKey/Value) structs and ran Pack()/Unpack() based on https://pkg.go.dev/github.com/go-restruct/restruct and reflection.
I also set up a testing framework where the different Pack/Unpack() implementations can be tested against each other. For example, manual Pack() with "restruct" Unpack(), and vice versa.
TODO: Need to gather some test data for the new tables and finish the manually-implemented Pack/Unpack() for them.