-
Notifications
You must be signed in to change notification settings - Fork 246
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
v1: add the read method #74
Conversation
db9e207
to
c21875c
Compare
return &v1.PermissionsService_ServiceDesc | ||
} | ||
|
||
func NewPermissionsServer(ds datastore.Datastore, nsm namespace.Manager) v1.PermissionsServiceServer { |
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.
Doc comment
tupleUserset := tuple.User.GetUserset() | ||
|
||
subjectRelation := "" | ||
if tupleUserset.Relation != datastore.Ellipsis { |
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.
We're not returning ...
anymore either?
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.
Nope. I don't think we should.
cmd/spicedb/root.go
Outdated
grpcprom.UnaryServerInterceptor, | ||
) | ||
|
||
grpcServer, err := cobrautil.GrpcServerFromFlags(cmd, middleware) | ||
stream_middlware := grpc.ChainStreamInterceptor( |
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.
there's no snake case in go -- some people use it in package names, but even that's dubious
we need to fix the linter so stuff like this gets caught.
|
||
atRevision := consistency.RevisionFromContext(ctx) | ||
if atRevision == nil { | ||
return status.Error(codes.Internal, "consistency middleware did not inject revision") |
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.
I think this should panic.
return status.Errorf(codes.Canceled, "request canceled: %s", err) | ||
|
||
case errors.As(err, &graph.ErrAlwaysFail{}): | ||
fallthrough |
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.
Is this supposed to be fallthrough? into OutOfRange? probably not
return &v1.PermissionsService_ServiceDesc | ||
} | ||
|
||
func NewPermissionsServer(ds datastore.Datastore, nsm namespace.Manager) v1.PermissionsServiceServer { |
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.
maybe this should be private, and RegisterPermissionsServer
should build the server too. then you're forced to register with middleware (unless you're a test in this package)
} | ||
|
||
err := resp.Send(&v1.ReadRelationshipsResponse{ | ||
ReadAt: zedtoken.NewFromRevision(*atRevision), |
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.
build the token outside of the loop?
Signed-off-by: Jake Moshenko <jacob.moshenko@gmail.com>
Signed-off-by: Jake Moshenko <jacob.moshenko@gmail.com>
No description provided.