~/bend-docscommunity

src/watcher.bend checks

raw source on the hub · import bend-kube-runtime@0.1.1.0/src/watcher.bend as Watcher

3 imports
import Base
import ./json.bend as J
import ./core.bend as C

Types

type Phase source · line 27 · raw

Data

What to do next: list (from a continue token, "" for the first page) or watch from a version.

type WState source · line 33 · raw

Data

fails counts failures since the last success; first says the next page starts a fresh list.

type Input source · line 36 · raw

Data

type Out source · line 44 · raw

Data

What the store and controller see (kube-runtime's watcher::Event).

type Step source · line 53 · raw

Data

A step's result: the next state, its outputs in order, and whether the driver must back off before the next action.

Definitions

def WState.init source · line 56 · raw

WState

def Backoff.delay.go source · line 59 · raw

@+fails:U32 -> @capped:Bool -> U32

def Backoff.delay source · line 71 · raw

@+fails:U32 -> U32

The delay before the next try after fails failures: 800ms doubling, at most 30s. The driver adds jitter.

def Watcher.page_outs source · line 77 · raw

@xs:List<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json> -> @tail:List<&2, Out> -> List<&2, Out>

def Watcher.init_out source · line 84 · raw

@first:Bool -> @rest:List<&2, Out> -> List<&2, Out>

def Watcher.done_out source · line 91 · raw

@last:Bool -> List<&2, Out>

def Watcher.page_phase source · line 98 · raw

@rv:String -> @+cont:String -> @last:Bool -> Phase

def Watcher.page.go source · line 105 · raw

@first:Bool -> @items:List<&2, 0x7222ee9dc1fb2fecc4a955ab3997433b/src/json.Json> -> @rv:String -> @+cont:String -> @+last:Bool -> Step

def Watcher.page source · line 112 · raw

@first:Bool -> @p:0x7222ee9dc1fb2fecc4a955ab3997433b/src/core.Page -> Step

A page of the list: the first page opens a relist (Init), the last one (no continue token) closes it (InitDone) and starts the watch.

def Watcher.is_gone source · line 117 · raw

@+code:U32 -> Bool

def Watcher.relist source · line 120 · raw

@+fails:U32 -> Step

def Watcher.retry source · line 123 · raw

@p:Phase -> @+fails:U32 -> @first:Bool -> Step

def Watcher.list_err source · line 128 · raw

@cont:String -> @+fails:U32 -> @first:Bool -> @gone:Bool -> Step

A failed list: an expired continue token relists; else the same page is retried after a backoff.

def Watcher.watch_err source · line 135 · raw

@rv:String -> @+fails:U32 -> @gone:Bool -> Step

def Watcher.event source · line 143 · raw

@rv:String -> @+fails:U32 -> @ev:0x7222ee9dc1fb2fecc4a955ab3997433b/src/core.WEvent -> Step

One watch event while watching from rv.

def Watcher.step source · line 159 · raw

@st:WState -> @i:Input -> Step

The state machine.

def Watcher.merge.go source · line 175 · raw

@outs:List<&2, Out> -> @w:Bool -> @s:Step -> Step

def Watcher.merge source · line 183 · raw

@acc:Step -> @x:Input -> Step

Feeds a run of inputs (the events of one recv), joining the outputs. A step that asks to back off ends the run's effect on the stream: the driver reconnects.

def Watcher.steps source · line 188 · raw

@xs:List<&2, Input> -> @acc:Step -> Step