README

zlhahaha/moonsim/models does not have a README file

#
Backoff

#
EventFailureCase

#
EventKind

Built-in event categories for deterministic model traces.

#
EventMutationPolicy

#
EventRecord

#
EventReplayResult

#
EventStream

#
EventStreamSnapshot

#
InvariantCheck

#
InvariantReport

#
MessageBus

#
Sim

Deterministic simulation state.

#
TimerPlan

#
TraceEntry

A deterministic record of an action observed during a simulation run.

#
ValidationIssue

#
ValidationReport

#
CircuitBreaker

pub(all) struct CircuitBreaker {
name : String
config : CircuitBreakerConfig
state : String
failures : Int
opened_tick : Int
trial_successes : Int
}

#
CircuitBreaker::allow

#
CircuitBreaker::new

fn CircuitBreaker::new(name : String, config? : CircuitBreakerConfig) -> CircuitBreaker

#
CircuitBreaker::record_failure

fn CircuitBreaker::record_failure(self : CircuitBreaker, sim :
Sim
) -> Unit

#
CircuitBreaker::record_success

fn CircuitBreaker::record_success(self : CircuitBreaker, sim :
Sim
) -> Unit

#
CircuitBreaker::state

fn CircuitBreaker::state(self : CircuitBreaker) -> String

#
CircuitBreakerConfig

pub(all) struct CircuitBreakerConfig {
failure_threshold : Int
reset_timeout : Int
half_open_successes : Int
}

#
CircuitBreakerResult

pub(all) struct CircuitBreakerResult {
state : String
allowed : Int
rejected : Int
successes : Int
failures : Int
final_tick : Int
digest : UInt64
}

#
CircuitBreakerResult::summary

#
HttpFailureCase

pub(all) struct HttpFailureCase {
scenario : String
policy : HttpReliabilityPolicy
seed : UInt64
failed_rule : String
digest : UInt64
exchanges : Array[RecordedHttpExchange]
options : HttpReplayOptions
}

A reproducible failing sample that can be checked after a policy change.

#
HttpFailureCase::replay

Replay the exact recording, seed, policy, and variation settings.

#
HttpFailureCase::verify_fixed_policy

fn HttpFailureCase::verify_fixed_policy(self : HttpFailureCase, policy : HttpReliabilityPolicy) -> HttpReplayResult

Recheck a failing recording with a revised policy and the original seed.

#
HttpOutcome

pub(all) enum HttpOutcome {
Response(HttpResponse)
ConnectionFailure(String)
Cancelled
}

The externally observed terminal result of an HTTP exchange.

#
HttpReliabilityPolicy

pub(all) struct HttpReliabilityPolicy {
seed : UInt64
timeout_ticks : Int
retry_limit : Int
backoff_ticks : Int
rate_limit_per_tick : Int
circuit_failure_threshold : Int
circuit_reset_ticks : Int
deadline_ticks : Int
accept_late_success : Bool
}

Retry and reliability rules evaluated during a deterministic replay.

#
HttpReplayOptions

pub(all) struct HttpReplayOptions {
latency_jitter : Int
injected_failure_percent : Int
reverse_same_tick_order : Bool
}

Optional deterministic changes applied to a recorded transport.

#
HttpReplayResult

pub(all) struct HttpReplayResult {
policy : HttpReliabilityPolicy
http_successes : Int
on_time_successes : Int
late_successes : Int
late_success_accepted : Int
failed : Int
timed_out : Int
connection_failures : Int
cancelled : Int
duplicate_processed : Int
retry_limit_violations : Int
rate_limited : Int
circuit_rejected : Int
deadline_misses : Int
digest : UInt64
invariants :
InvariantReport

trace : Array[
TraceEntry
]
}

Aggregate result and evidence from a recorded HTTP replay.

#
HttpRequest

pub(all) struct HttpRequest {
id : String
http_method : String
path : String
attempt : Int
}

The request metadata captured by an external HTTP integration test.

#
HttpResponse

pub(all) struct HttpResponse {
status : Int
body_summary : String
}

A compact response summary. Bodies are deliberately not retained by default.

#
LoadBalancerConfig

pub(all) struct LoadBalancerConfig {
seed : UInt64
jobs : Int
workers : Int
max_arrival_gap : Int
min_service : Int
max_service : Int
strategy : String
}

#
LoadBalancerResult

pub(all) struct LoadBalancerResult {
jobs : Int
workers : Int
strategy : String
final_tick : Int
max_queue_depth : Int
total_wait : Int
events_executed : Int
digest : UInt64
}

#
ModelSummary

pub(all) struct ModelSummary {
name : String
digest : UInt64
final_tick : Int
events : Int
}

#
ModelSummary::line

fn ModelSummary::line(self : ModelSummary) -> String

#
NetworkConfig

pub(all) struct NetworkConfig {
seed : UInt64
messages : Int
latency_min : Int
latency_max : Int
drop_percent : Int
retry_delay : Int
}

#
NetworkResult

pub(all) struct NetworkResult {
messages : Int
delivered : Int
dropped : Int
retries : Int
pending : Int
final_tick : Int
digest : UInt64
trace : Array[
TraceEntry
]
}

#
QueueConfig

pub(all) struct QueueConfig {
seed : UInt64
customers : Int
max_arrival_gap : Int
service_time : Int
}

#
QueueResult

pub(all) struct QueueResult {
customers : Int
events_executed : Int
final_tick : Int
min_arrival : Int
max_arrival : Int
digest : UInt64
trace : Array[
TraceEntry
]
}

#
QueueResult::event_stream

Projects queue arrivals and completions into the shared message event stream.

#
RecordedHttpExchange

pub(all) struct RecordedHttpExchange {
request : HttpRequest
outcome : HttpOutcome
started_tick : Int
latency_ticks : Int
}

One HTTP exchange recorded outside the simulator.

#
RecordedHttpTransport

pub(all) struct RecordedHttpTransport {
scenario : String
exchanges : Array[RecordedHttpExchange]
options : HttpReplayOptions
}

A pure replay transport. It never opens a socket or invokes a real service.

#
RecordedHttpTransport::event_stream

Projects recorded calls into the common external-call event representation.

#
RecordedHttpTransport::failure_case

Return the first failed invariant as replayable evidence, if any.

#
RecordedHttpTransport::replay

Replay the recording with virtual time and a deterministic seed.

#
RecordedHttpTransport::to_json

fn RecordedHttpTransport::to_json(self : RecordedHttpTransport, policy? : HttpReliabilityPolicy) -> String

Emit stable JSON evidence. This encoder only serializes the compact model types.

#
ReliabilityConfig

pub(all) struct ReliabilityConfig {
seed : UInt64
operations : Int
fail_percent : Int
retry_limit : Int
backoff : Int
}

#
ReliabilityResult

pub(all) struct ReliabilityResult {
operations : Int
successes : Int
failures : Int
retries : Int
exhausted : Int
final_tick : Int
digest : UInt64
trace : Array[
TraceEntry
]
}

#
ReliabilityResult::line

fn ReliabilityResult::line(self : ReliabilityResult) -> String

#
ReliabilityResult::success_rate_percent

fn ReliabilityResult::success_rate_percent(self : ReliabilityResult) -> Int

#
ReliabilityResult::summary

#
RetryConfig

pub(all) struct RetryConfig {
seed : UInt64
max_attempts : Int
fail_until : Int
initial_backoff : Int
jitter : Int
}

#
RetryResult

pub(all) struct RetryResult {
attempts : Int
retries : Int
success : Bool
final_tick : Int
digest : UInt64
trace : Array[
TraceEntry
]
}

#
SeedMatrix

pub(all) struct SeedMatrix {
name : String
runs : Array[SeedRun]
}

#
SeedMatrix::add

fn SeedMatrix::add(self : SeedMatrix, run : SeedRun) -> SeedMatrix

#
SeedMatrix::combined_digest

fn SeedMatrix::combined_digest(self : SeedMatrix) -> UInt64

#
SeedMatrix::count

fn SeedMatrix::count(self : SeedMatrix) -> Int

#
SeedMatrix::fastest

fn SeedMatrix::fastest(self : SeedMatrix) -> SeedRun?

#
SeedMatrix::has_seed

fn SeedMatrix::has_seed(self : SeedMatrix, seed : UInt64) -> Bool

#
SeedMatrix::is_empty

fn SeedMatrix::is_empty(self : SeedMatrix) -> Bool

#
SeedMatrix::lines

fn SeedMatrix::lines(self : SeedMatrix) -> Array[String]

#
SeedMatrix::max_final_tick

fn SeedMatrix::max_final_tick(self : SeedMatrix) -> Int

#
SeedMatrix::new

fn SeedMatrix::new(name : String) -> SeedMatrix

#
SeedMatrix::render

fn SeedMatrix::render(self : SeedMatrix) -> String

#
SeedMatrix::slowest

fn SeedMatrix::slowest(self : SeedMatrix) -> SeedRun?

#
SeedMatrix::summary_line

fn SeedMatrix::summary_line(self : SeedMatrix) -> String

#
SeedMatrix::tick_span

fn SeedMatrix::tick_span(self : SeedMatrix) -> Int

#
SeedMatrix::total_events

fn SeedMatrix::total_events(self : SeedMatrix) -> Int

#
SeedMatrix::unique_digests

fn SeedMatrix::unique_digests(self : SeedMatrix) -> Int

#
SeedMatrixComparison

pub(all) struct SeedMatrixComparison {
left_name : String
right_name : String
same_digest : Bool
same_count : Bool
left_digest : UInt64
right_digest : UInt64
left_count : Int
right_count : Int
}

#
SeedMatrixComparison::count_changed

fn SeedMatrixComparison::count_changed(self : SeedMatrixComparison) -> Bool

#
SeedMatrixComparison::digest_changed

fn SeedMatrixComparison::digest_changed(self : SeedMatrixComparison) -> Bool

#
SeedMatrixComparison::fully_changed

fn SeedMatrixComparison::fully_changed(self : SeedMatrixComparison) -> Bool

#
SeedMatrixComparison::is_stable

fn SeedMatrixComparison::is_stable(self : SeedMatrixComparison) -> Bool

#
SeedMatrixComparison::matched

fn SeedMatrixComparison::matched(self : SeedMatrixComparison) -> Bool

#
SeedMatrixComparison::summary

fn SeedMatrixComparison::summary(self : SeedMatrixComparison) -> String

#
SeedRun

pub(all) struct SeedRun {
seed : UInt64
summary : ModelSummary
}

#
ServiceResilienceConfig

pub(all) struct ServiceResilienceConfig {
seed : UInt64
requests : Int
workers : Int
queue_limit : Int
timeout_ticks : Int
retry_limit : Int
base_latency : Int
jitter : Int
fail_percent : Int
drop_percent : Int
rate_limit_capacity : Int
rate_limit_refill : Int
rate_limit_interval : Int
min_success_percent : Int
}

#
ServiceResilienceResult

pub(all) struct ServiceResilienceResult {
config : ServiceResilienceConfig
accepted : Int
rejected : Int
completed : Int
failed : Int
timed_out : Int
late_successes : Int
retried : Int
rate_limited : Int
circuit_rejected : Int
max_queue_depth : Int
final_tick : Int
slo_passed : Bool
latency_count : Int
latency_min : Int
latency_max : Int
latency_sum : Int
digest : UInt64
invariants :
InvariantReport

trace : Array[
TraceEntry
]
}

#
ServiceResilienceResult::average_latency

fn ServiceResilienceResult::average_latency(self : ServiceResilienceResult) -> Int

#
ServiceResilienceResult::line

#
ServiceResilienceResult::success_percent

fn ServiceResilienceResult::success_percent(self : ServiceResilienceResult) -> Int

#
ServiceResilienceResult::summary

#
TokenBucket

pub(all) struct TokenBucket {
name : String
capacity : Int
refill : Int
interval : Int
tokens : Int
last_refill_tick : Int
}

#
TokenBucket::allow

fn TokenBucket::allow(self : TokenBucket, sim :
Sim
, cost? : Int) -> Bool

#
TokenBucket::new

fn TokenBucket::new(name : String, capacity? : Int, refill? : Int, interval? : Int) -> TokenBucket

#
TokenBucket::refill_to

fn TokenBucket::refill_to(self : TokenBucket, tick : Int) -> Unit

#
TokenBucketResult

pub(all) struct TokenBucketResult {
allowed : Int
rejected : Int
final_tokens : Int
final_tick : Int
digest : UInt64
}

#
TokenBucketResult::summary

#
TrafficConfig

pub(all) struct TrafficConfig {
seed : UInt64
cycles : Int
cars : Int
cycle_ticks : Int
}

#
TrafficResult

pub(all) struct TrafficResult {
cars : Int
green_phases : Int
red_phases : Int
events_executed : Int
final_tick : Int
digest : UInt64
}

#
WorkflowPlan

pub(all) struct WorkflowPlan {
worker_count : Int
tasks : Array[WorkflowTask]
}

#
WorkflowPlan::add

fn WorkflowPlan::add(self : WorkflowPlan, name : String, duration : Int, deps? : Array[Int]) -> WorkflowPlan

#
WorkflowPlan::new

fn WorkflowPlan::new(worker_count? : Int) -> WorkflowPlan

#
WorkflowPlan::task_count

fn WorkflowPlan::task_count(self : WorkflowPlan) -> Int

#
WorkflowResult

pub(all) struct WorkflowResult {
tasks : Int
workers : Int
final_tick : Int
critical_path : Int
runs : Array[WorkflowTaskRun]
digest : UInt64
}

#
WorkflowResult::event_stream

Projects completed workflow runs into the shared task event stream.

#
WorkflowResult::render

fn WorkflowResult::render(self : WorkflowResult) -> String

#
WorkflowResult::summary

#
WorkflowTask

pub(all) struct WorkflowTask {
id : Int
name : String
duration : Int
deps : Array[Int]
}

#
WorkflowTaskRun

pub(all) struct WorkflowTaskRun {
id : Int
name : String
worker : Int
start_tick : Int
finish_tick : Int
}

#
circuit_breaker_config

fn circuit_breaker_config(failure_threshold? : Int, reset_timeout? : Int, half_open_successes? : Int) -> CircuitBreakerConfig

#
compare_seed_matrices

fn compare_seed_matrices(left : SeedMatrix, right : SeedMatrix) -> SeedMatrixComparison

#
http_reliability_policy

fn http_reliability_policy(seed? : UInt64, timeout_ticks? : Int, retry_limit? : Int, backoff_ticks? : Int, rate_limit_per_tick? : Int, circuit_failure_threshold? : Int, circuit_reset_ticks? : Int, deadline_ticks? : Int, accept_late_success? : Bool) -> HttpReliabilityPolicy

Build a replay policy. A zero rate limit disables rate limiting.

#
http_replay_options

fn http_replay_options(latency_jitter? : Int, injected_failure_percent? : Int, reverse_same_tick_order? : Bool) -> HttpReplayOptions

Build deterministic variation settings for a recorded transport.

#
http_request

fn http_request(id : String, http_method? : String, path? : String, attempt? : Int) -> HttpRequest

Build a recorded request. Attempts start at one.

#
http_response

fn http_response(status : Int, body_summary? : String) -> HttpResponse

Build a response summary suitable for deterministic replay.

#
invariant_check

fn invariant_check(name : String, passed : Bool, detail? : String) ->
InvariantCheck

#
load_balancer_config

fn load_balancer_config(seed? : UInt64, jobs? : Int, workers? : Int, max_arrival_gap? : Int, min_service? : Int, max_service? : Int, strategy? : String) -> LoadBalancerConfig

#
load_balancer_seed_matrix

fn load_balancer_seed_matrix(seeds : Array[UInt64], strategy? : String) -> SeedMatrix

#
load_balancer_summary

fn load_balancer_summary(result : LoadBalancerResult) -> ModelSummary

#
network_config

fn network_config(seed? : UInt64, messages? : Int, latency_min? : Int, latency_max? : Int, drop_percent? : Int, retry_delay? : Int) -> NetworkConfig

#
network_seed_matrix

fn network_seed_matrix(seeds : Array[UInt64]) -> SeedMatrix

#
network_summary

fn network_summary(result : NetworkResult) -> ModelSummary

#
package_name

fn package_name() -> String

#
queue_config

fn queue_config(seed? : UInt64, customers? : Int, max_arrival_gap? : Int, service_time? : Int) -> QueueConfig

#
queue_summary

fn queue_summary(result : QueueResult) -> ModelSummary

#
recorded_http_exchange

fn recorded_http_exchange(request : HttpRequest, outcome : HttpOutcome, started_tick? : Int, latency_ticks? : Int) -> RecordedHttpExchange

Build an externally recorded exchange.

#
recorded_http_transport

fn recorded_http_transport(scenario : String, exchanges : Array[RecordedHttpExchange], options? : HttpReplayOptions) -> RecordedHttpTransport

Create a transport from HTTP exchanges captured by an external test.

#
reliability_config

fn reliability_config(seed? : UInt64, operations? : Int, fail_percent? : Int, retry_limit? : Int, backoff? : Int) -> ReliabilityConfig

#
render_service_resilience_report

fn render_service_resilience_report(result : ServiceResilienceResult) -> String

#
retry_config

fn retry_config(seed? : UInt64, max_attempts? : Int, fail_until? : Int, initial_backoff? : Int, jitter? : Int) -> RetryConfig

#
retry_seed_matrix

fn retry_seed_matrix(seeds : Array[UInt64]) -> SeedMatrix

#
retry_summary

fn retry_summary(result : RetryResult) -> ModelSummary

#
retry_timeout_fault_policy

fn retry_timeout_fault_policy() -> HttpReliabilityPolicy

A deliberately unsafe policy used to demonstrate a detected invariant failure.

#
retry_timeout_fixed_policy

fn retry_timeout_fixed_policy() -> HttpReliabilityPolicy

The corrected policy rejects an original success that arrived after its deadline.

#
retry_timeout_recording

fn retry_timeout_recording() -> RecordedHttpTransport

A small fixture showing a retry whose original request succeeds after its deadline.

#
run_circuit_breaker_model

fn run_circuit_breaker_model(seed? : UInt64, calls? : Int) -> CircuitBreakerResult

#
run_load_balancer_model

fn run_load_balancer_model(config : LoadBalancerConfig) -> LoadBalancerResult

#
run_network_model

fn run_network_model(config : NetworkConfig) -> NetworkResult

#
run_queue_model

fn run_queue_model(config : QueueConfig) -> QueueResult

#
run_reliability_model

fn run_reliability_model(config : ReliabilityConfig) -> ReliabilityResult

#
run_retry_model

fn run_retry_model(config : RetryConfig) -> RetryResult

#
run_service_resilience_suite

fn run_service_resilience_suite(config? : ServiceResilienceConfig) -> ServiceResilienceResult

#
run_token_bucket_model

fn run_token_bucket_model(seed? : UInt64, requests? : Int) -> TokenBucketResult

#
run_traffic_model

fn run_traffic_model(config : TrafficConfig) -> TrafficResult

#
run_workflow_model

fn run_workflow_model(plan : WorkflowPlan, seed? : UInt64) -> WorkflowResult

#
seed_run

fn seed_run(seed : UInt64, summary : ModelSummary) -> SeedRun

#
service_resilience_config

fn service_resilience_config(seed? : UInt64, requests? : Int, workers? : Int, queue_limit? : Int, timeout_ticks? : Int, retry_limit? : Int, base_latency? : Int, jitter? : Int, fail_percent? : Int, drop_percent? : Int, rate_limit_capacity? : Int, rate_limit_refill? : Int, rate_limit_interval? : Int, min_success_percent? : Int) -> ServiceResilienceConfig

#
service_resilience_seed_matrix

fn service_resilience_seed_matrix(seeds : Array[UInt64]) -> SeedMatrix

#
timer_plan

fn timer_plan(name : String, start_after? : Int, interval? : Int, times? : Int, priority? : Int) ->
TimerPlan

#
trace_digest

fn trace_digest(entries : Array[
TraceEntry
]) -> UInt64

#
trace_entry

fn trace_entry(tick : Int, event_id : Int, kind : String, detail : String) ->
TraceEntry

#
traffic_config

fn traffic_config(seed? : UInt64, cycles? : Int, cars? : Int, cycle_ticks? : Int) -> TrafficConfig

#
traffic_summary

fn traffic_summary(result : TrafficResult) -> ModelSummary

#
validation_issue

fn validation_issue(code : String, message : String, severity? : String) ->
ValidationIssue

#
version

fn version() -> String

#
workflow_critical_path

fn workflow_critical_path(plan : WorkflowPlan) -> Int