Class TransportCompression

java.lang.Object
io.deephaven.server.arrow.TransportCompression

public final class TransportCompression extends Object
Chooses the compression type for a Barrage response from the table's allowed list, or the server's default list, and the compression types the client accepts; and holds the compression types the server uses.
  • Field Details

    • DEFAULT_TYPES_PROPERTY

      public static final String DEFAULT_TYPES_PROPERTY
      The compression types the server allows for a Table or HierarchicalTable that does not set Table.TRANSPORT_COMPRESSION_ATTRIBUTE, as an ordered, comma-separated list in the attribute's format, such as zstd,snappy. Unset by default, so such tables are never compressed. The server ignores a value it cannot parse, and logs a warning.
      See Also:
    • ENABLED_TYPES

      public static final List<String> ENABLED_TYPES
      The compression types this server compresses responses and decompresses requests with, sorted by name: every supported type whose TransportCompression.<type>.enabled property the server's configuration does not set to false. The server's gRPC registries hold only these types.
    • DISABLED_TYPES

      public static final List<String> DISABLED_TYPES
      The supported types that the server's configuration disables, sorted by name. The server neither compresses nor decompresses with them, but tables may still name them, and the server then uses the next type on the table's list.
  • Method Details

    • apply

      public static Optional<String> apply(@NotNull @NotNull io.grpc.stub.StreamObserver<?> responseObserver, @NotNull @NotNull Set<String> accepted, @Nullable @Nullable AttributeMap<?> attributes, @NotNull @NotNull String logName)
      Sets the compression of responseObserver to the first type in attributes' allowed list that the client accepts and this server has a compressor for, using the server's default list when the object does not set one or sets one that cannot be parsed. Leaves the response uncompressed when the object has no attributes, nothing matches, or the observer cannot be compressed. Must be called before the first response message is sent.
      Parameters:
      responseObserver - the raw gRPC response observer for the call
      accepted - the compression types the client accepts, from ClientAcceptCompressionInterceptor
      attributes - the attributes of the object being sent, or null if it has none
      logName - a description of the object being sent, for log messages
      Returns:
      the chosen compression type, or empty if the response is not compressed