~/bend-docscommunity

src/lease.bend checks

raw source on the hub · import bend-kube-runtime@0.2.0.0/src/lease.bend as Lease

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

Types

type Obs source · line 23 · raw

Data

What we last saw of the record, and when (our clock, in ms).

type LeaseAct source · line 26 · raw

Data

type Decision source · line 31 · raw

Data

Definitions

def Obs.none source · line 34 · raw

Obs

def Lease.spec source · line 37 · raw

@+l:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json -> @field:String -> 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json

def Lease.holder source · line 40 · raw

@+l:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json -> String

def Lease.renew_time source · line 43 · raw

@+l:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json -> String

def Lease.transitions source · line 46 · raw

@+l:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json -> U32

def Lease.new_spec source · line 49 · raw

@id:String -> @+dur:U32 -> @acquire:String -> @renew:String -> @+trans:U32 -> 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json

def Lease.fresh source · line 55 · raw

@ns:String -> @name:String -> @id:String -> @+dur:U32 -> @+now:String -> 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json

A fresh Lease naming us.

def Lease.observe.go source · line 60 · raw

@h:String -> @r:String -> @o:Obs -> @+now:U32 -> @same:Bool -> Obs

def Lease.observe source · line 69 · raw

@+l:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json -> @o:Obs -> @+now:U32 -> Obs

The record seen now: the old observation if nothing changed, else a new one stamped now.

def Lease.held source · line 76 · raw

@+l:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json -> @+me:String -> @o:Obs -> @+now:U32 -> @+dur:U32 -> Bool

Whether another holder's lease is still live by our clock.

def Lease.take.go source · line 83 · raw

@+l:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json -> @me:String -> @+dur:U32 -> @+now:String -> @ours:Bool -> 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json

def Lease.take source · line 92 · raw

@+l:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json -> @+me:String -> @+dur:U32 -> @+now:String -> 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json

The Lease rewritten to name us, keeping its metadata (resourceVersion).

def Lease.decide.fin source · line 95 · raw

@+l:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json -> @+me:String -> @o:Obs -> @+dur:U32 -> @+now:String -> @held:Bool -> Decision

def Lease.decide.held source · line 103 · raw

@+l:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json -> @+me:String -> @+o:Obs -> @+now_ms:U32 -> @+dur:U32 -> @+now:String -> Decision

def Lease.decide.got source · line 107 · raw

@+l:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json -> @+me:String -> @o:Obs -> @+now_ms:U32 -> @+dur:U32 -> @+now:String -> Decision

def Lease.decide source · line 113 · raw

@cur:Maybe<&2, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json> -> @ns:String -> @name:String -> @+me:String -> @o:Obs -> @+now_ms:U32 -> @+dur:U32 -> @+now:String -> Decision

One round: the Lease read (None when absent), us, what we saw before, our clock in ms, the lease duration in seconds, and the time to stamp.

def Lease.release source · line 123 · raw

@+l:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json -> @+now:String -> 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json

The Lease handed back: no holder, a one-second duration, so the next candidate takes it at once (client-go's ReleaseOnCancel).