-
Notifications
You must be signed in to change notification settings - Fork 8
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
Slim jimm model #1488
Slim jimm model #1488
Conversation
* remove non-essential fields from model * remove fields from yaml env * refactor model summaries
* remove controller watcher
fix migration fix
6f69fc8
to
a5d440f
Compare
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.
some comments... Feel like we can do them in this branch
// modelSummariesMap is a safe map to add records concurrently because the access is guarded by a Mutex. | ||
// The read operations are not guarded because only inserts are done concurrently. | ||
type modelSummariesMap struct { | ||
mu sync.Mutex |
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.
Can just use sync.Map, no need for mutex @SimoneDutto
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.
from the go doc, you use sync.Map for very specific use case. Usually they advice you to use a separate mutex.
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.
Ah I see, so if routine A handles keys 1-10, and routine B handled keys 11-20, then sync.Map is preferred. Never noticed the second part really.
@@ -71,6 +71,7 @@ type ModelManager interface { | |||
ImportModel(ctx context.Context, user *openfga.User, controllerName string, modelTag names.ModelTag, newOwner string) error | |||
ModelDefaultsForCloud(ctx context.Context, user *dbmodel.Identity, cloudTag names.CloudTag) (jujuparams.ModelDefaultsResult, error) | |||
ModelInfo(ctx context.Context, u *openfga.User, mt names.ModelTag) (*jujuparams.ModelInfo, error) | |||
ModelSummaries(ctx context.Context, user *openfga.User, maskingControllerUUID string) (jujuparams.ModelSummaryResults, error) |
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.
This interface is confusing lol (not you)
|
||
// ModelSummaries returns the list of modelsummary the user has access to. | ||
// It queries the controllers and then merge the info from the JIMM db. | ||
func (j *JIMM) ModelSummaries(ctx context.Context, user *openfga.User, maskingControllerUUID string) (jujuparams.ModelSummaryResults, error) { |
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.
Probavbly better to just name it ListModelSummaries right?
Description
feature-brach into v3, with merge conflicts
Fixes JIRA/GitHub issue number
Engineering checklist
Check only items that apply
Test instructions
Notes for code reviewers