Class CloudLimits

java.lang.Object
com.ultikits.ultitools.websocket.CloudLimits

@Internal public final class CloudLimits extends Object
Immutable limits from one accepted welcome; internal, not for module use. Values follow the frozen protocol contract's bounds and are rejected, not clamped, when invalid. A new connection may negotiate a different snapshot.
Since:
6.3.1
  • Field Details

    • maxFrameBytes

      private final int maxFrameBytes
    • logRatePerSec

      private final int logRatePerSec
    • logBurst

      private final int logBurst
    • logLineMaxBytes

      private final int logLineMaxBytes
    • logBatchMaxLines

      private final int logBatchMaxLines
    • outboxMax

      private final int outboxMax
    • commandDedupeMax

      private final int commandDedupeMax
    • commandDedupeTtlSeconds

      private final int commandDedupeTtlSeconds
    • commandOutputMaxBytes

      private final int commandOutputMaxBytes
    • fileMaxBytes

      private final int fileMaxBytes
  • Constructor Details

    • CloudLimits

      private CloudLimits(int maxFrameBytes, int logRatePerSec, int logBurst, int logLineMaxBytes, int logBatchMaxLines, int outboxMax, int commandDedupeMax, int commandDedupeTtlSeconds, int commandOutputMaxBytes, int fileMaxBytes)
  • Method Details

    • defaults

      public static CloudLimits defaults()
      Returns:
      the frozen protocol's DEFAULT_LIMITS, used before welcome
    • fromWelcome

      public static CloudLimits fromWelcome(com.google.gson.JsonObject limits)
      Reads the exact welcome.limits shape, including its nested log object.
      Parameters:
      limits - all required integer fields, with no unknown fields
      Returns:
      an immutable snapshot with every value inside the contract bounds
      Throws:
      IllegalArgumentException - if the shape, types or bounds are invalid
    • exactKeys

      private static void exactKeys(com.google.gson.JsonObject object, String... keys)
    • integer

      private static int integer(com.google.gson.JsonObject object, String key, int min, int max)
    • maxFrameBytes

      public int maxFrameBytes()
      Returns:
      maximum UTF-8 bytes of a complete serialized frame
    • logRatePerSec

      public int logRatePerSec()
      Returns:
      log lines replenished per second in the token bucket
    • logBurst

      public int logBurst()
      Returns:
      maximum log-line burst allowed by the token bucket
    • logLineMaxBytes

      public int logLineMaxBytes()
      Returns:
      maximum UTF-8 bytes of one serialized log-line object
    • logBatchMaxLines

      public int logBatchMaxLines()
      Returns:
      maximum number of lines in one log.lines batch
    • outboxMax

      public int outboxMax()
      Returns:
      maximum number of unacknowledged reliable events retained
    • commandDedupeMax

      public int commandDedupeMax()
      Returns:
      maximum number of deduplicated request ids retained
    • commandDedupeTtlSeconds

      public int commandDedupeTtlSeconds()
      Returns:
      deduplication retention time in seconds
    • commandOutputMaxBytes

      public int commandOutputMaxBytes()
      Returns:
      maximum UTF-8 bytes of the serialized command-output array
    • fileMaxBytes

      public int fileMaxBytes()
      Returns:
      maximum raw UTF-8 file-content bytes, not JSON frame bytes