Class ClusterNodeAgent

java.lang.Object
org.j7m.middleware.cluster.ClusterNodeAgent
All Implemented Interfaces:
AutoCloseable, ClusterNodeEndpoint, ManagedInvocation

public final class ClusterNodeAgent extends Object implements ClusterNodeEndpoint, AutoCloseable
Durable, serialized physical effect admission. Highest fence, intent and schema watermark are fsynced before runtime mutation. An incomplete intent is reconciled from actual host state; an unprovable replacement reports UNKNOWN instead of blindly replaying a potentially destructive action. A newer controller cannot overlap a still executing old action in the same node agent.
  • Constructor Details

    • ClusterNodeAgent

      public ClusterNodeAgent(HostingSupervisor host, org.j7m.middleware.distributed.ResourceEndpoint authority, Supplier<org.j7m.middleware.consensus.NetworkConsensusStatus> consensus, Map<String, ReleaseDescriptor> catalog, Path journal, int initialSchema) throws IOException
      Opens one agent's durable journal.
      Parameters:
      host - real hosting supervisor
      authority - quorum-authoritative lifecycle scope
      consensus - actual local consensus status source
      catalog - trusted release catalog
      journal - private durable agent journal
      initialSchema - known initial persisted schema
      Throws:
      IOException - corrupt or unavailable journal
  • Method Details

    • status

      public ClusterNodeEndpoint.Status status(Instant deadline) throws IOException
      Reads actual node state.
      Specified by:
      status in interface ClusterNodeEndpoint
      Parameters:
      deadline - absolute deadline
      Returns:
      local hosting and fresh consensus status
      Throws:
      IOException - unavailable
    • step

      public NodeView step(String operation, String phase, String release, String owner, long fence, long epoch, Instant deadline) throws IOException
      Executes one locally journaled fenced physical step, reconciling exact retries.
      Specified by:
      step in interface ClusterNodeEndpoint
      Parameters:
      operation - durable operation identity
      phase - DRAIN or REPLACE
      release - server catalog identity
      owner - lease owner
      fence - current fence
      epoch - current leadership epoch
      deadline - absolute deadline
      Returns:
      actual post-effect hosting view
      Throws:
      IOException - stale authority or uncertain completion
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException
    • invoke

      public byte[] invoke(String requestId, String contract, byte[] payload, Instant deadline) throws IOException
      Invokes a configured service contract; callers cannot select classes or methods.
      Specified by:
      invoke in interface ManagedInvocation
      Parameters:
      requestId - stable business request identity
      contract - server-configured contract alias
      payload - bounded opaque application bytes
      deadline - absolute deadline
      Returns:
      independent application result bytes
      Throws:
      IOException - unavailable, drained or unknown completion
    • invokeRevision

      public byte[] invokeRevision(String release, String requestId, String contract, byte[] payload, Instant deadline) throws IOException
      Invokes only when the admission gate still hosts the selected revision.
      Specified by:
      invokeRevision in interface ManagedInvocation
      Parameters:
      release - selected revision
      requestId - stable identity
      contract - configured alias
      payload - application bytes
      deadline - absolute deadline
      Returns:
      application response
      Throws:
      IOException - when revision pinning is unsupported or admission fails