-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Experimental Relationship Counter API #1901
Add Experimental Relationship Counter API #1901
Conversation
6d7b6fd
to
5e3e649
Compare
3bed801
to
c2a68e0
Compare
This supports registration, unregistration and counting, but does not yet use a service, which means *all* CountRelationships calls will invoke a `count(*)` on the underlying datastore, which could be slow Fixes authzed#1860
c2a68e0
to
0180264
Compare
internal/datastore/crdb/migrations/zz_migration.0006_add_relationship_counters_table.go
Show resolved
Hide resolved
internal/datastore/crdb/migrations/zz_migration.0006_add_relationship_counters_table.go
Show resolved
Hide resolved
} | ||
|
||
func (r *pgReader) LookupCounters(ctx context.Context) ([]datastore.RelationshipCounter, error) { | ||
return r.lookupCounters(ctx, "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about a constant for the ""
?
} | ||
|
||
snapshotReader := ds.SnapshotReader(headRev) | ||
count, err := snapshotReader.CountRelationships(ctx, req.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we never store the count or read the stored count?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not currently; its designed so we can layer the counting service on top as the followup
…s and adding TODOs to the rest
35eaf1f
to
76d92f4
Compare
Updated |
See #1860