Class ManagedPartitionClient

java.lang.Object
org.j7m.middleware.application.distributed.ManagedPartitionClient

public final class ManagedPartitionClient extends Object
Typed quorum client for a trusted portable reducer program and fixed authenticated scope. A locality preference gets at most100ms and one quarter of the remaining budget before same-group fallback; it never extends the original deadline. Stable request identity and business bytes survive topology refresh; receipt epochs describe historical commits and never grant current write authority. IOException leaves an UNKNOWN outcome. This facade is thread-safe with thread-safe borrowed routing/endpoints/codec; it owns no threads.
  • Constructor Details

    • ManagedPartitionClient

      public ManagedPartitionClient(ManagedPartitionClient.Routes routes, Map<String, ManagedPartitionClient.Group> groups, org.j7m.middleware.application.api.ManagedPartitionDefinition<?> program, String fingerprint, String scope, org.j7m.middleware.codec.api.ValueCodec codec, org.j7m.middleware.codec.api.SchemaRegistry schemas)
      Creates a typed facade over finite authenticated routing and endpoint capabilities.
      Parameters:
      routes - trusted fresh topology source, normally an existing PartitionRouter
      groups - authorized native group identities and same-group locality preferences,1..256
      program - validated generated POJO program metadata
      fingerprint - locally verified portable program fingerprint, not a caller assertion
      scope - fixed server-authorized resource scope
      codec - borrowed explicit effect-free value codec
      schemas - explicit matching A01 data allowlist
      Throws:
      IllegalArgumentException - for invalid types, routing declarations or inventory bounds
  • Method Details

    • routingKey

      public String routingKey(Object command)
      Extracts a stable canonical routing key through the actual declared scalar/schema selector. Use the same key for related reads; it is routing data and grants no ownership authority.
      Parameters:
      command - concrete command or a data-only key template of the same schema
      Returns:
      lowercase64-character key independent of non-key command fields
      Throws:
      IllegalArgumentException - for invalid key data
      IllegalStateException - when the program does not declare a shard selector
    • execute

      public ManagedPartitionResource.Receipt execute(String request, Object command, Instant deadline) throws IOException
      Commits using the actual declared scalar or numeric schema-field shard selector.
      Parameters:
      request - stable bounded business identity, unchanged on retries
      command - bounded concrete command data
      deadline - original absolute deadline, never extended by topology refresh
      Returns:
      first durable receipt or explicit uncommitted OVERLOADED receipt
      Throws:
      IOException - for unavailable quorum, cancellation or UNKNOWN outcome
      IllegalArgumentException - if no valid shard selector is declared or input conflicts
    • execute

      public ManagedPartitionResource.Receipt execute(String request, String key, Object command, Instant deadline) throws IOException
      Commits on an explicit stable key; a declared selector must still match the command itself.
      Parameters:
      request - stable bounded business identity
      key - explicit routing key, at most128 characters
      command - bounded concrete command data
      deadline - original absolute deadline
      Returns:
      durable first-commit or uncommitted overload receipt
      Throws:
      IOException - for unavailable quorum, cancellation or UNKNOWN outcome
      IllegalArgumentException - for mismatched shard or conflicting business input
    • query

      public Object query(String key, Object query, Instant deadline) throws IOException
      Reads a concrete view under fresh topology and quorum ownership barriers.
      Parameters:
      key - stable application routing key
      query - bounded concrete query data
      deadline - original absolute deadline
      Returns:
      independent decoded view
      Throws:
      IOException - for unavailable quorum or cancellation
      IllegalArgumentException - for invalid schema or routing input
    • query

      public <V> V query(String key, Object query, Class<V> expectedType, Instant deadline) throws IOException
      Reads a view while checking the caller's requested Java type against the actual program.
      Type Parameters:
      V - expected concrete view type
      Parameters:
      key - stable routing key
      query - concrete query data
      expectedType - exact declared view type, including its primitive/boxed equivalent
      deadline - original absolute deadline
      Returns:
      concrete independent decoded view
      Throws:
      IllegalArgumentException - before RPC if the requested view type differs
      IOException - for unavailable quorum, cancellation or UNKNOWN outcome