pure.bend checks
raw source on the hub · import bend-kit-hairpin@0.19.0.1/pure.bend as Pure
5 imports
import Base import bend-kit-http@0.45.0.1/pure.bend as Pure import bend-kit-time@0.3.0.4/pure.bend as Time import bend-kit-url@0.4.1.0/url.bend as Url import bend-kit-retry@0.3.0.0/retry.bend as Retry
Types
type Verdict source · line 40 · raw
Data
A judge's verdict on one attempt. Ok: a success. Caller: the request is at fault (a 4xx), so it stops and the breaker does not count it. Target: the target failed in a way another try would repeat, so it stops and the breaker counts it. Again: another try may help; after is the Retry-After value, "" for none.
VerdictOkVerdict
VerdictCallerVerdict
VerdictTargetVerdict
VerdictAgain@after:String -> Verdict
Definitions
def target.pick source · line 7 · raw
@none:Bool -> @b:String -> @ref:String -> Maybe<&2, String>
def target source · line 15 · raw
@+b:String -> @ref:String -> Maybe<&2, String>
ref against the base (RFC 3986 §5.2); with no base, ref as given. None when the base is not absolute.
def target.abs source · line 18 · raw
@m:Maybe<&2, String> -> Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs>
def merge source · line 27 · raw
@defaults:Map<&2, List<&2, String>> -> @headers:Map<&2, List<&2, String>> -> Map<&2, List<&2, String>>
The defaults under the request headers, names lowercased; a request header replaces a default of its name. Host, Connection, Content-Length, and Transfer-Encoding are the client's own, so both sides drop them.
def hint.ms source · line 30 · raw
@m:Maybe<&2, U32> -> Maybe<&2, Nat>
def outcome source · line 47 · raw
@+idem:Bool -> @v:Verdict -> @now:0x9f4a3f2c7133e5a83260013bf45115fd/pure.Instant -> 0x14e48621ef66156b0eb652524b8594d4/retry.Outcome
Ok is Settled, Caller is Rejected, and Target is Failed. Again is Transient for an idempotent request, else Unsafe.
def judge.status source · line 59 · raw
@+s:U32 -> Verdict
A status that Pure.retry.judge does not retry: below 400 is Ok, a 4xx is Caller, and the rest is Target.
def judge.settled source · line 62 · raw
@r:Result<&1, &1, 0xf0810503fa2a9fb55fa01b9145a73254/pure.Err, 0xf0810503fa2a9fb55fa01b9145a73254/pure.Res> -> Pair(Result<&1, &1, 0xf0810503fa2a9fb55fa01b9145a73254/pure.Err, 0xf0810503fa2a9fb55fa01b9145a73254/pure.Res>, Verdict)
def judge.of source · line 70 · raw
@x:Pair(Result<&1, &1, 0xf0810503fa2a9fb55fa01b9145a73254/pure.Err, 0xf0810503fa2a9fb55fa01b9145a73254/pure.Res>, Maybe<&2, String>) -> Pair(Result<&1, &1, 0xf0810503fa2a9fb55fa01b9145a73254/pure.Err, 0xf0810503fa2a9fb55fa01b9145a73254/pure.Res>, Verdict)
def judge source · line 79 · raw
@r:Result<&1, &1, 0xf0810503fa2a9fb55fa01b9145a73254/pure.Err, 0xf0810503fa2a9fb55fa01b9145a73254/pure.Res> -> Pair(Result<&1, &1, 0xf0810503fa2a9fb55fa01b9145a73254/pure.Err, 0xf0810503fa2a9fb55fa01b9145a73254/pure.Res>, Verdict)
The default judge: Pure.retry.judge, as if the request were idempotent, picks Again; outcome then applies idem.