Skip to content

Commit

Permalink
peek/pop dancec
Browse files Browse the repository at this point in the history
  • Loading branch information
devinrsmith committed Dec 11, 2024
1 parent f44eb01 commit 44270d5
Showing 1 changed file with 29 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.deephaven.base.string.EncodingInfo;
import io.deephaven.engine.context.ExecutionContext;
import io.deephaven.engine.context.QueryScope;
import io.deephaven.engine.liveness.LivenessManager;
import io.deephaven.engine.liveness.LivenessScopeStack;
import io.deephaven.engine.table.Table;
import io.deephaven.proto.backplane.grpc.Ticket;
Expand Down Expand Up @@ -63,13 +64,19 @@ public SessionState.ExportObject<Flight.FlightInfo> flightInfoFor(
if (!(scopeVar instanceof Table)) {
throw newNotFoundSRE(logId, scopeName);
}
final LivenessManager peek = LivenessScopeStack.peek();
final Flight.FlightInfo flightInfo;
try (final SafeCloseable ignored = LivenessScopeStack.open()) {
final Table transformed = authorization.transform((Table) scopeVar);
if (transformed == null) {
throw newNotFoundSRE(logId, scopeName);
LivenessScopeStack.push(peek);
try {
if (transformed == null) {
throw newNotFoundSRE(logId, scopeName);
}
flightInfo = TicketRouter.getFlightInfo(transformed, descriptor, flightTicketForName(scopeName));
} finally {
LivenessScopeStack.pop(peek);
}
flightInfo = TicketRouter.getFlightInfo(transformed, descriptor, flightTicketForName(scopeName));
}
return SessionState.wrapAsExport(flightInfo);
}
Expand All @@ -81,14 +88,20 @@ public void forAllFlightInfo(@Nullable final SessionState session, final Consume
}
final QueryScope queryScope = ExecutionContext.getContext().getQueryScope();
queryScope.toMap(queryScope::unwrapObject, (n, t) -> t instanceof Table).forEach((name, table) -> {
final LivenessManager peek = LivenessScopeStack.peek();
final Flight.FlightInfo flightInfo;
try (final SafeCloseable ignored = LivenessScopeStack.open()) {
final Table transformedTable = authorization.transform((Table) table);
if (transformedTable == null) {
return;
LivenessScopeStack.push(peek);
try {
if (transformedTable == null) {
return;
}
flightInfo = TicketRouter.getFlightInfo(transformedTable, descriptorForName(name),
flightTicketForName(name));
} finally {
LivenessScopeStack.pop(peek);
}
flightInfo = TicketRouter.getFlightInfo(transformedTable, descriptorForName(name),
flightTicketForName(name));
}
visitor.accept(flightInfo);
});
Expand Down Expand Up @@ -118,12 +131,18 @@ private <T> SessionState.ExportObject<T> resolve(final String scopeName, final S
if (export == null) {
return SessionState.wrapAsFailedExport(newNotFoundSRE(logId, scopeName));
}
final LivenessManager peek = LivenessScopeStack.peek();
try (final SafeCloseable ignored = LivenessScopeStack.open()) {
export = authorization.transform(export);
if (export == null) {
return SessionState.wrapAsFailedExport(newNotFoundSRE(logId, scopeName));
LivenessScopeStack.push(peek);
try {
if (export == null) {
return SessionState.wrapAsFailedExport(newNotFoundSRE(logId, scopeName));
}
return SessionState.wrapAsExport(export);
} finally {
LivenessScopeStack.pop(peek);
}
return SessionState.wrapAsExport(export);
}
}

Expand Down

0 comments on commit 44270d5

Please sign in to comment.