Skip to content
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

Merged
merged 2 commits into from
Sep 15, 2021
Merged

v1: add the read method #74

merged 2 commits into from
Sep 15, 2021

Conversation

jakedt
Copy link
Member

@jakedt jakedt commented Sep 14, 2021

No description provided.

@jakedt jakedt marked this pull request as draft September 14, 2021 20:55
@github-actions github-actions bot added the area/api v1 Affects the v1 API label Sep 14, 2021
@jakedt jakedt force-pushed the v1-read branch 2 times, most recently from db9e207 to c21875c Compare September 14, 2021 22:28
return &v1.PermissionsService_ServiceDesc
}

func NewPermissionsServer(ds datastore.Datastore, nsm namespace.Manager) v1.PermissionsServiceServer {
Copy link
Member

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 {
Copy link
Member

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?

Copy link
Member Author

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.

grpcprom.UnaryServerInterceptor,
)

grpcServer, err := cobrautil.GrpcServerFromFlags(cmd, middleware)
stream_middlware := grpc.ChainStreamInterceptor(
Copy link
Member

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")
Copy link
Member

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
Copy link
Member

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 {
Copy link
Contributor

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),
Copy link
Contributor

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>
@github-actions github-actions bot added the area/api v0 Affects the v0 API label Sep 15, 2021
@jakedt jakedt marked this pull request as ready for review September 15, 2021 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api v0 Affects the v0 API area/api v1 Affects the v1 API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants