~/bend-docscommunity

pure.bend checks

raw source on the hub · import bend-kit-hairpin@0.19.0.2/pure.bend as Pure

5 imports
import Base
import bend-kit-http@0.45.0.2/pure.bend as Pure
import bend-kit-time@0.3.0.5/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.

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:0x05acb84fe7d232c08b57d385772acf76/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, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res> -> Pair(Result<&1, &1, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>, Verdict)

def judge.of source · line 70 · raw

@x:Pair(Result<&1, &1, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>, Maybe<&2, String>) -> Pair(Result<&1, &1, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>, Verdict)

def judge source · line 79 · raw

@r:Result<&1, &1, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res> -> Pair(Result<&1, &1, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Err, 0x4d71b23c258b4427dab7d9dc31d9b3dc/pure.Res>, Verdict)

The default judge: Pure.retry.judge, as if the request were idempotent, picks Again; outcome then applies idem.