Package-level declarations

Types

Link copied to clipboard

A command's result as a peer answers it, read by the one reader the client reads every answer with.

Link copied to clipboard
fun interface EndpointResolver

Where a client finds the service of a context: the base URL of its Port, such as http://ordering:8080. Wow keeps no registry and balances no load: a resolver that picks an instance per call (from a service registry, DNS or a sidecar) is the application's, and is asked again on every attempt, so a retry may reach another instance.

Link copied to clipboard

The credential headers of the request a coroutine serves, which UserCredential.FORWARDED forwards: the host's edge puts them in the context of the request's handler, so code that calls a peer while serving the request calls it as the request's end user.

Link copied to clipboard

The synchronous calls of a node's sagas to the HTTP command gateways of other contexts: the service mode of the command client (ClientMode.Service), at the base URL endpoints gives each context's internal port (wow.peers.<context>.url), the only one that takes a call; its public port refuses Wow-Call. Each call goes to the command's route as the contracts list it (CommandIndex.routeOf), those of the peers' api jars on the class path by default, as the HttpCommandClient sends one (a command whose body names its aggregate to its route without an id), and carries:

Link copied to clipboard
class NamedCommand(val type: String, val body: JsonNode)

A command named by its type rather than by its class: a command to a peer described by its Manifest alone (wow.peers.<context>.contract: manifest), which a console, a gateway or a tool calls without the peer's api jar. type is its full type name, context.aggregate.Command (the aggregate's type and the command's name in the peer's Manifest, or one of its aliases), and body its JSON, sent as is.

Link copied to clipboard
class PeerClients(modes: Map<String, PeerMode>, local: Set<String>, contracts: Set<String>, service: Lazy<WowClient>, user: Lazy<WowClient>, defaultMode: PeerMode, val serviceName: String, val described: Set<String> = emptySet())

The peer contexts the service reaches over HTTP (routing moved here from the host): each context of modes by the client of its mode, service or user. Every context of modes must be a peer the contracts on the class path declare (contracts), not one of the service's own, unless it is one of described, the peers described by their Manifest alone (contract: manifest), which no contract on the class path may declare.

Link copied to clipboard
class PeerList(targets: List<URI>, val generation: Long) : List<URI>

The targets one lookup of a peer's nodes found, and its generation: a lookup that finds them again, the same nodes or not, has another, so a client knows the list was read again (SilentPeers). What a discovery that caches its lookups answers (REFRESH); a resolver that answers plain lists has no generations, and a bypassed node then comes back after REFRESH.

Link copied to clipboard
enum class PeerMode : Enum<PeerMode>

How a peer context is reached over HTTP: SERVICE, on its internal port as this service, asserting the caller as the root of the call (ClientMode.Service); USER, on its public routes, forwarding the end user's credential (ClientMode.User).

Link copied to clipboard
class PeerProblem(val status: Int, val code: String?, val detail: String?, val result: CommandResult?, val retry: RetryAdvice, val retryAfter: Duration?, val version: Int? = null, val cause: Throwable? = null, val title: String? = null, val violations: List<Violation> = emptyList(), val extensions: Map<String, Any?> = emptyMap())

A problem a peer answered with (RFC 9457): its HTTP status, its Wow code (none for one that is only HTTP's, or a body that is no problem, such as a proxy's), its detail, the command's result when it had a ref, what a retry may do and after how long (retryAfter, its Retry-After), and the aggregate's version it answered: a rejection's, or the current one a state read of a minimum version was answered with (wow.query.min-version-not-reached). A failure the client's transport met itself (no node reached, a connection lost) is one too, of a catalog code, with that failure as its cause.

Link copied to clipboard
enum class Port : Enum<Port>

The port of a peer's service a client calls: its PUBLIC routes, which forward the end user's credential, or its INTERNAL port, which takes a service's synchronous calls and peer reads (Wow-Call).

Link copied to clipboard

Reads problems as a Wow server writes them: what a retry may do is the problem's retry member, which every problem carries (the error catalog's for its code when it lacks one), its wait the Retry-After it came with, else the catalog's. A body that is no Wow problem (a proxy's, a gateway's) may be retried with the same request id when it is a 503 or a 429, which nothing behind it handled, or a 502 or a 504: the gateway does not say whether the node behind it took the request and committed it (a 502's node may have failed mid-answer, a 504's may still be running it), and the same request id is safe either way, a command that did commit answered as the duplicate it is (#6810). Any other status of such a body is RetryAdvice.NONE.

Link copied to clipboard

How often a client sends a request again that a peer answered with a problem a retry may get past, each time after the Retry-After the peer answered with, else after backoff doubled at each attempt:

Link copied to clipboard
class RoutedCommandClient(local: CommandClient, peers: PeerClients, aggregatesOf: (Class<*>) -> List<AggregateType>, caller: Caller = Caller.ANONYMOUS) : CommandClient

The service's CommandClient: a command to an aggregate of a peer context peers reach goes over HTTP, any other through local, the node's gateway (in process, or a peer's command topic). A request without a type goes to the one aggregatesOf (the node's models and the contracts on the class path) gives its command's class, a NamedCommand's to the one its type names.

Link copied to clipboard

The service's NodeQueryApi: the models of a peer context peers reach over HTTP, any other in process through local; a state class of none of the node's models (localStates) is a peer's, found by its contract. Trusted queries are in process alone: a peer reads for a caller.

Link copied to clipboard
class SilentPeers @JvmOverloads constructor(observer: Observer = Observer.NONE, lapse: Duration = PeerList.REFRESH, clock: () -> Long = System::nanoTime)

The nodes of each peer context that took a request and did not answer it within its bound: the requests that follow choose among the context's other nodes (choose), so a node lost without notice (a pod deleted by force, whose address drops packets) costs one request its bound rather than every request that rotates onto it until the list is read again. It is not a health check: it sends no probe. A command is never sent again to a node that went silent: it is sent again under the same request id at most once, and only to another live node, which forwards it to the partition's owner, so its outcome is settled as a duplicate or a commit; with no other live node it fails once as wow.command.unknown.

Link copied to clipboard
fun interface UserCredential

The credential a client forwards in user mode: the request headers that make the peer's public port authenticate the end user a call acts for, its caller, as its own edge did (Authorization, and CoSec's CoSec-App-Id when the application is part of what it authorizes). The peer decides the caller's identity, tenant and scope from them alone: a client asserts nothing.

Link copied to clipboard

The typed clients of the peers' HTTP routes, all on one JDK HttpClient and one EndpointResolver, in one ClientMode: commands sends command objects as the location-transparent CommandClient does in process, and queries reads their snapshots, events, datasets and states as the QueryApi does. A peer's commands and state classes are found in the contract its api jar carries, read from the class path: a consumer depends on the peer's *-api and writes no path.