Skip to content

Commit

Permalink
Create gRPC SessionService#publishFromTicket (deephaven#4101)
Browse files Browse the repository at this point in the history
Fixes deephaven#4075.

Colin pointed out that DnD needs to be able to disable publishing to ScopeTickets for PQ's (which need to have frozen query scopes). This adds a flag that can be set. It highlights that we might need to add authorization hooks for TicketResolver#publish.

This is a breaking change for DnD shim as it changes the TicketResolver API to add a callback that can be invoked once the publish is complete.
  • Loading branch information
nbauernfeind authored Jul 5, 2023
1 parent ac6a1f9 commit 57e2047
Show file tree
Hide file tree
Showing 35 changed files with 2,324 additions and 376 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.deephaven.proto.backplane.grpc.ExportNotificationRequest;
import io.deephaven.proto.backplane.grpc.ExportRequest;
import io.deephaven.proto.backplane.grpc.HandshakeRequest;
import io.deephaven.proto.backplane.grpc.PublishRequest;
import io.deephaven.proto.backplane.grpc.ReleaseRequest;
import io.deephaven.proto.backplane.grpc.SessionServiceGrpc;
import io.deephaven.proto.backplane.grpc.TerminationNotificationRequest;
Expand Down Expand Up @@ -42,6 +43,8 @@ default ServerServiceDefinition intercept(SessionServiceGrpc.SessionServiceImplB
service, "Release", null, this::onMessageReceivedRelease));
serviceBuilder.addMethod(ServiceAuthWiring.intercept(
service, "ExportFromTicket", null, this::onMessageReceivedExportFromTicket));
serviceBuilder.addMethod(ServiceAuthWiring.intercept(
service, "PublishFromTicket", null, this::onMessageReceivedPublishFromTicket));
serviceBuilder.addMethod(ServiceAuthWiring.intercept(
service, "ExportNotifications", null, this::onMessageReceivedExportNotifications));
serviceBuilder.addMethod(ServiceAuthWiring.intercept(
Expand Down Expand Up @@ -95,6 +98,15 @@ default ServerServiceDefinition intercept(SessionServiceGrpc.SessionServiceImplB
*/
void onMessageReceivedExportFromTicket(AuthContext authContext, ExportRequest request);

/**
* Authorize a request to PublishFromTicket.
*
* @param authContext the authentication context of the request
* @param request the request to authorize
* @throws io.grpc.StatusRuntimeException if the user is not authorized to invoke PublishFromTicket
*/
void onMessageReceivedPublishFromTicket(AuthContext authContext, PublishRequest request);

/**
* Authorize a request to ExportNotifications.
*
Expand Down Expand Up @@ -127,6 +139,9 @@ public void onMessageReceivedRelease(AuthContext authContext, ReleaseRequest req

public void onMessageReceivedExportFromTicket(AuthContext authContext, ExportRequest request) {}

public void onMessageReceivedPublishFromTicket(AuthContext authContext,
PublishRequest request) {}

public void onMessageReceivedExportNotifications(AuthContext authContext,
ExportNotificationRequest request) {}

Expand Down Expand Up @@ -156,6 +171,11 @@ public void onMessageReceivedExportFromTicket(AuthContext authContext, ExportReq
ServiceAuthWiring.operationNotAllowed();
}

public void onMessageReceivedPublishFromTicket(AuthContext authContext,
PublishRequest request) {
ServiceAuthWiring.operationNotAllowed();
}

public void onMessageReceivedExportNotifications(AuthContext authContext,
ExportNotificationRequest request) {
ServiceAuthWiring.operationNotAllowed();
Expand Down Expand Up @@ -201,6 +221,13 @@ public void onMessageReceivedExportFromTicket(AuthContext authContext, ExportReq
}
}

public void onMessageReceivedPublishFromTicket(AuthContext authContext,
PublishRequest request) {
if (delegate != null) {
delegate.onMessageReceivedPublishFromTicket(authContext, request);
}
}

public void onMessageReceivedExportNotifications(AuthContext authContext,
ExportNotificationRequest request) {
if (delegate != null) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 57e2047

Please sign in to comment.