Skip to content

Commit

Permalink
refactor: Rewrite JS API to share server implementation of Flight/Bar…
Browse files Browse the repository at this point in the history
…rage (deephaven#5890)

Rewrites JS API Flight/Barrage to share code as much as possible with
the JVM client/server implementation. Some classes are effectively
copied with minor updates to function in the browser, such as
WebBarrageStreamReader. Others offer alternative implementations to
generic interfaces, like WebChunkReaderFactory. Finally, super source is
added to handle classes in Deephaven, gRPC, and Java itself, to allow
use of those types in the browser.

Notably, JS clients subscriptions are now the same implementation for
both viewports and full table subscriptions. This change may degrade
performance of viewports in some case relative to previous versions. To
help mitigate this, in certain cases the configuration property
`web.flattenViewport` may improve things. This lets the server instruct
all clients to flatten their tables before subscribing.

Fixes deephaven#188
Fixes deephaven#186
  • Loading branch information
niloc132 committed Sep 10, 2024
1 parent 6cb5d7d commit 41d5cc0
Show file tree
Hide file tree
Showing 185 changed files with 6,875 additions and 15,379 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@
/py @chipkent @jmao-denver @rcaudy
/R @chipkent @alexpeters1208 @rcaudy
*.proto @devinrsmith @nbauernfeind @niloc132 @rcaudy
*.gwt.xml @niloc132 @rcaudy @nbauernfeind
4 changes: 4 additions & 0 deletions Base/src/main/resources/io/deephaven/base/Base.gwt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<module>
<source path="" includes="MathUtil.java" />
<source path="verify" />
</module>
3 changes: 3 additions & 0 deletions IO/src/main/resources/io/deephaven/io/IO.gwt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<module>
<source path="streams" includes="ByteBufferInputStream.java" />
</module>
2 changes: 1 addition & 1 deletion Util/src/main/java/io/deephaven/util/MultiException.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void printStackTrace(PrintStream s) {
@Override
public String getMessage() {
StringBuilder sb = new StringBuilder();
sb.append(super.getMessage()).append(": \n");
sb.append(super.getMessage()).append(":\n");
for (int i = 0; i < causes.length; i++) {
sb.append("Cause ").append(i).append(": ");
sb.append(causes[i].toString());
Expand Down
10 changes: 10 additions & 0 deletions Util/src/main/resources/io/deephaven/Util.gwt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<module>
<inherits name="io.deephaven.base.Base" />
<source path="util" includes="SafeCloseable.java,SimpleTypeMap.java,QueryConstants.java,BooleanUtils.java" />
<source path="util/type" includes="ArrayTypeUtils.java,TypeUtils.java" />
<source path="util/codec" includes="ObjectDecoder.java" />
<source path="util/datastructures" includes="LongAbortableConsumer.java,LongRangeAbortableConsumer.java,LongRangeIterator.java,LongRangeConsumer.java,LongSizedDataStructure.java,SizeException.java,SegmentedSoftPool.java" />
<source path="util/mutable" />
<source path="util/compare" />
<source path="" includes="UncheckedDeephavenException.java" />
</module>
1 change: 1 addition & 0 deletions buildSrc/src/main/groovy/GwtTools.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class GwtTools {
generateJsInteropExports = true
// TODO move this down a line when we want to give clients js that is not super strict / rigged to blow
checkAssertions = true
setExtraArgs('-includeJsInteropExports', 'io.deephaven.*')
if (gwtDev) {
saveSource = true
extra = extras
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<module>
<inherits name="io.deephaven.base.Base" />
<inherits name="io.deephaven.Util" />
<source path="" />
<source path="util/pools" excludes="ChunkPoolReleaseTracking.java" />
</module>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<module>
<source path="" />
</module>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<module>
<inherits name="io.deephaven.chunk.Chunk" />
<inherits name="io.deephaven.engine.primitive.function.Function" />
<inherits name="io.grpc.Grpc" />
<source path="" includes="BarrageSnapshotOptions.java,BarrageSubscriptionOptions.java,ColumnConversionMode.java,ImmutableBarrageSnapshotOptions.java,ImmutableBarrageSubscriptionOptions.java,DrainableByteArrayInputStream.java" />
<source path="util" includes="StreamReaderOptions.java,FlatBufferIteratorAdapter.java,DefensiveDrainable.java,DefensiveCapture.java,ExposedByteArrayOutputStream.java" />
<source path="chunk">
<exclude name="vector/*" />
<exclude name="VectorChunkInputStreamGenerator.java" />
<exclude name="VectorChunkReader.java" />
<exclude name="DefaultChunkReadingFactory.java" />
<exclude name="DefaultChunkInputStreamGeneratorFactory.java" />
</source>
</module>
5 changes: 4 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ tdunning = "3.2"
trove = "3.0.3"
undercouch = "2.15.1"
univocity = "2.6.0"
vertispan-nio = "1.0-alpha-1"
vertispan-nio = "1.0-alpha-2"
vertispan-flatbuffers-gwt = "1.12.0-1"
vertispan-ts-defs = "1.0.0-RC4"

# test versions
Expand Down Expand Up @@ -287,6 +288,8 @@ univocity-parsers = { module = "com.univocity:univocity-parsers", version.ref =

vertispan-nio-gwt = { module = "com.vertispan.nio:gwt-nio", version.ref = "vertispan-nio" }

vertispan-flatbuffers-gwt = { module = "com.vertispan.flatbuffers:flatbuffers-gwt", version.ref = "vertispan-flatbuffers-gwt" }

vertispan-ts-defs-annotations = { module = "com.vertispan.tsdefs:jsinterop-ts-defs-annotations", version.ref = "vertispan-ts-defs" }
vertispan-ts-defs-doclet = { module = "com.vertispan.tsdefs:jsinterop-ts-defs-doclet", version.ref = "vertispan-ts-defs" }

Expand Down
5 changes: 4 additions & 1 deletion props/configs/src/main/resources/dh-defaults.prop
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ web.storage.notebook.directory=/notebooks
web.webgl=true
web.webgl.editable=true

# Default to not flattening web viewports, but allow it as an option
web.flattenViewports=false

# List of configuration properties to provide to unauthenticated clients, so that they can decide how best to prove their
# identity to the server.
authentication.client.configuration.list=AuthHandlers

# List of configuration properties to provide to authenticated clients, so they can interact with the server.
client.configuration.list=java.version,deephaven.version,barrage.version,groovy.version,python.version,http.session.durationMs,file.separator,web.storage.layout.directory,web.storage.notebook.directory,web.webgl,web.webgl.editable
client.configuration.list=java.version,deephaven.version,barrage.version,groovy.version,python.version,http.session.durationMs,file.separator,web.storage.layout.directory,web.storage.notebook.directory,web.webgl,web.webgl.editable,web.flattenViewports

# Version list to add to the configuration property list. Each `=`-delimited pair denotes a short name for a versioned
# jar, and a class that is found in that jar. Any such keys will be made available to the client.configuration.list
Expand Down
138 changes: 0 additions & 138 deletions proto/raw-js-openapi/flight_format/Message.fbs

This file was deleted.

3 changes: 0 additions & 3 deletions proto/raw-js-openapi/flight_format/README.md

This file was deleted.

Loading

0 comments on commit 41d5cc0

Please sign in to comment.