Class CanaryDeployment
java.lang.Object
org.j7m.middleware.cluster.CanaryDeployment
- All Implemented Interfaces:
AutoCloseable
Quorum-backed canary traffic controller invoking real managed application endpoints.
Each policy is CAS-versioned in the authenticated resource scope. Readiness is obtained through
the lifecycle's live inspection. Missing/stale observations cause HOLD and cannot raise exposure.
Bad candidate observations atomically disable candidate admission before lifecycle rollback/drain.
Completion timeout is UNKNOWN: this class never retries an application invocation automatically.
Metrics count calls made through this instance; restarting requires fresh minimum samples.
Instances are thread-safe; close stops evaluation, not application effects or durable policies.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordCandidate observations without request identities or application payloads.static interfaceOptional concrete observation adapter; returning null or throwing means missing probes.static final recordDurable controller state. -
Constructor Summary
ConstructorsConstructorDescriptionCanaryDeployment(String scope, org.j7m.middleware.distributed.ResourceEndpoint resources, ClusterLifecycle lifecycle, Map<String, ManagedInvocation> endpoints) Creates an automatically evaluated controller using measured local invocation outcomes.CanaryDeployment(String scope, org.j7m.middleware.distributed.ResourceEndpoint resources, ClusterLifecycle lifecycle, Map<String, ManagedInvocation> endpoints, CanaryDeployment.ProbeReader probes) Creates a controller with an optional external observation adapter. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()configure(String request, long expectedVersion, CanaryPolicy policy, Instant deadline) Installs an increasing revision after fresh readiness/probe checks; retries use the same request ID.Evaluates fresh readiness and measured error/mean-latency thresholds, resuming durable rollback.byte[]Invokes one actual managed endpoint selected by the durable policy and request identity.metrics()Returns bounded identity-free controller counters.Reads the current quorum-authoritative policy.
-
Constructor Details
-
CanaryDeployment
public CanaryDeployment(String scope, org.j7m.middleware.distributed.ResourceEndpoint resources, ClusterLifecycle lifecycle, Map<String, ManagedInvocation> endpoints) Creates an automatically evaluated controller using measured local invocation outcomes.- Parameters:
scope- authenticated policy namespace, bounded deployment identityresources- scope-bound durable CAS endpointlifecycle- concrete remote cluster lifecycleendpoints- actual managed invocation clients by node identity, 1..64- Throws:
IllegalArgumentException- for invalid scope or endpoint capacity
-
CanaryDeployment
public CanaryDeployment(String scope, org.j7m.middleware.distributed.ResourceEndpoint resources, ClusterLifecycle lifecycle, Map<String, ManagedInvocation> endpoints, CanaryDeployment.ProbeReader probes) Creates a controller with an optional external observation adapter. The adapter must authenticate its source and return measurements for the supplied revision.- Parameters:
scope- authenticated namespaceresources- durable CAS endpointlifecycle- concrete cluster lifecycleendpoints- managed invocation clients by nodeprobes- external probe reader, or null for local measured calls- Throws:
IllegalArgumentException- for invalid scope or endpoint capacity
-
-
Method Details
-
configure
public CanaryDeployment.Status configure(String request, long expectedVersion, CanaryPolicy policy, Instant deadline) throws IOException Installs an increasing revision after fresh readiness/probe checks; retries use the same request ID.- Parameters:
request- stable authorized operation identityexpectedVersion- expected resource version, zero for initial creationpolicy- new explicit traffic/threshold policydeadline- absolute deadline- Returns:
- committed policy state
- Throws:
IOException- for missing probes, readiness, CAS conflict or unknown commit
-
invoke
public byte[] invoke(String requestId, String contract, byte[] payload, Instant deadline) throws IOException Invokes one actual managed endpoint selected by the durable policy and request identity. No fallback invocation follows an ambiguous error; applications must reconcile by request ID.- Parameters:
requestId- stable application request identitycontract- exported application contractpayload- application bytes passed unchangeddeadline- absolute deadline- Returns:
- managed application response
- Throws:
IOException- on unavailable policy/owner or unknown application outcome
-
evaluate
Evaluates fresh readiness and measured error/mean-latency thresholds, resuming durable rollback.- Parameters:
deadline- absolute deadline for quorum/lifecycle operations- Returns:
- latest durable state, or null before configuration
- Throws:
IOException- for unavailable quorum or unknown lifecycle outcome
-
status
Reads the current quorum-authoritative policy.- Parameters:
deadline- absolute deadline- Returns:
- durable policy state, or null
- Throws:
IOException- on unavailable quorum or unsupported encoding
-
metrics
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-