src/pb.bend checks
raw source on the hub · import bend-kube-runtime@0.10.0.0/src/pb.bend as Pb
2 imports
import Base import ./utf8.bend as U
Types
type W64 source · line 22 · raw
Data
W64@hi:U32 -> @lo:U32 -> W64
type PbVal source · line 31 · raw
Data
A field's value, by wire type: PVar: 0, a varint PF64: 1, eight little-endian bytes PLen: 2, length-delimited raw bytes: a string, bytes, a nested message (Pb.decode them) or a packed repeated field PF32: 5, four little-endian bytes
PVar@v:W64 -> PbVal
PF64@v:W64 -> PbVal
PLen@bs:List<&2, U32> -> PbVal
PF32@v:U32 -> PbVal
type PbField source · line 37 · raw
Data
PbField@num:U32 -> @val:PbVal -> PbField
type PbStr source · line 41 · raw
Data
One entry of a map<string, string>.
PbStr@key:String -> @val:String -> PbStr
type PbSt source · line 51 · raw
Data
Where the decoder is. PVint: inside a varint; what is 0 for a key, 1 for a value, 2 for a length; sh is the shift of the next 7 bits PBody: left bytes of a length-delimited value to go, acc reversed PFix: left bytes of a fixed32 (wire 5) or fixed64 (wire 1), acc reversed PBad: a message the decoder refuses; it stays here
PVint@what:U32 -> @num:U32 -> @sh:U32 -> @acc:W64 -> PbSt
PBody@num:U32 -> @left:U32 -> @acc:List<&2, U32> -> PbSt
PFix@num:U32 -> @wire:U32 -> @left:U32 -> @acc:List<&2, U32> -> PbSt
PBad@why:String -> PbSt
type PbStep source · line 57 · raw
Data
PbStep@st:PbSt -> @got:Maybe<&2, PbField> -> PbStep
type PbVs source · line 411 · raw
Data
One varint after another: ev is the varint so far, or the last byte's verdict.
PbVs@sh:U32 -> @acc:W64 -> @out:List<&2, W64> -> PbVs
PbVsBad@why:String -> PbVs
Definitions
def Pb.max source · line 62 · raw
U32
The largest length-delimited value the decoder accepts: 64 MiB, past gRPC's own default limit of 4 MiB.
def Pb.zero source · line 65 · raw
W64
def Pb.w64 source · line 68 · raw
@+x:U32 -> W64
def Pb.lo source · line 71 · raw
@w:W64 -> U32
def Pb.hi source · line 76 · raw
@w:W64 -> U32
def Pb.w64.is_zero source · line 81 · raw
@w:W64 -> Bool
def Pb.w64.is_eq source · line 86 · raw
@a:W64 -> @b:W64 -> Bool
def Pb.int32.go source · line 91 · raw
@+x:U32 -> @neg:Bool -> W64
def Pb.int32 source · line 99 · raw
@+x:U32 -> W64
An int32 as protobuf sends it: sign-extended to 64 bits.
def Pb.zigzag.go source · line 102 · raw
@+hi:U32 -> @+lo:U32 -> @neg:Bool -> W64
def Pb.zigzag source · line 110 · raw
@w:W64 -> W64
sint64: (n << 1) ^ (n >> 63), so small negatives stay short.
def Pb.unzigzag.go source · line 115 · raw
@+hi:U32 -> @+lo:U32 -> @odd:Bool -> W64
def Pb.unzigzag source · line 123 · raw
@w:W64 -> W64
The inverse of Pb.zigzag: (n >> 1) ^ -(n & 1).
def Pb.varint.go source · line 131 · raw
@fuel:Nat -> @+hi:U32 -> @+lo:U32 -> @last:Bool -> List<&2, U32>
def Pb.varint source · line 144 · raw
@w:W64 -> List<&2, U32>
A varint: 7 bits a byte, low first, the top bit set on all but the last.
def Pb.varint32 source · line 149 · raw
@+x:U32 -> List<&2, U32>
def Pb.le32 source · line 153 · raw
@+x:U32 -> @rest:List<&2, U32> -> List<&2, U32>
A U32 as four little-endian bytes, before rest.
def Pb.key source · line 158 · raw
@+num:U32 -> @+wire:U32 -> List<&2, U32>
A field's key: its number and wire type.
def Pb.field source · line 161 · raw
@f:PbField -> List<&2, U32>
def Pb.encode source · line 174 · raw
@msg:List<&2, PbField> -> List<&2, U32>
A message's bytes: its fields in order.
def Pb.one source · line 188 · raw
@+f:PbField -> @omit:Bool -> List<&2, PbField>
def Pb.u64 source · line 196 · raw
@+num:U32 -> @+v:W64 -> List<&2, PbField>
uint64, int64, or an enum or int32 widened by Pb.int32.
def Pb.u32 source · line 199 · raw
@+num:U32 -> @+v:U32 -> List<&2, PbField>
def Pb.bool source · line 202 · raw
@+num:U32 -> @b:Bool -> List<&2, PbField>
def Pb.fixed64 source · line 205 · raw
@+num:U32 -> @+v:W64 -> List<&2, PbField>
def Pb.fixed32 source · line 208 · raw
@+num:U32 -> @+v:U32 -> List<&2, PbField>
def Pb.bytes source · line 211 · raw
@+num:U32 -> @+bs:List<&2, U32> -> List<&2, PbField>
def Pb.str source · line 214 · raw
@+num:U32 -> @s:String -> List<&2, PbField>
def Pb.msg source · line 218 · raw
@+num:U32 -> @m:List<&2, PbField> -> List<&2, PbField>
A nested message, sent even when empty: a message field has presence.
def Pb.msgs source · line 222 · raw
@+num:U32 -> @ms:List<&2, List<&2, PbField>> -> List<&2, PbField>
A repeated message or string field: one field per element.
def Pb.strs source · line 229 · raw
@+num:U32 -> @ss:List<&2, String> -> List<&2, PbField>
def Pb.packed.go source · line 236 · raw
@ws:List<&2, W64> -> List<&2, U32>
def Pb.packed source · line 244 · raw
@+num:U32 -> @ws:List<&2, W64> -> List<&2, PbField>
A packed repeated varint field, as proto3 sends repeated scalars.
def Pb.str_map source · line 248 · raw
@+num:U32 -> @kvs:List<&2, PbStr> -> List<&2, PbField>
A map<string, string>: one entry message per pair, key 1 and value 2.
def Pb.put.go source · line 259 · raw
@+b:U32 -> @+sh:U32 -> @+hi:U32 -> @+lo:U32 -> @low:Bool -> @zero:Bool -> W64
def Pb.put source · line 269 · raw
@+b:U32 -> @+sh:U32 -> @acc:W64 -> W64
Puts 7 bits b at shift sh of acc; bits past 64 fall off.
def Pb.bad source · line 274 · raw
@why:String -> PbStep
def Pb.begin source · line 277 · raw
PbSt
def Pb.emit source · line 280 · raw
@+num:U32 -> @v:PbVal -> PbStep
def Pb.wired source · line 283 · raw
@+num:U32 -> @wire:U32 -> PbStep
def Pb.keyed source · line 297 · raw
@+num:U32 -> @wire:U32 -> @zero:Bool -> @big:Bool -> PbStep
A key is whole: its wire type says what follows.
def Pb.sized.go source · line 306 · raw
@+num:U32 -> @+len:U32 -> @empty:Bool -> PbStep
def Pb.sized source · line 313 · raw
@+num:U32 -> @+len:U32 -> @big:Bool -> PbStep
def Pb.vint.done source · line 321 · raw
@what:U32 -> @+num:U32 -> @w:W64 -> PbStep
A varint is whole.
def Pb.vint source · line 330 · raw
@+what:U32 -> @+num:U32 -> @+sh:U32 -> @acc:W64 -> @last:Bool -> @long:Bool -> PbStep
def Pb.word source · line 340 · raw
@bs:List<&2, U32> -> U32
Four little-endian bytes, given reversed (most significant first).
def Pb.fixed source · line 347 · raw
@+num:U32 -> @wire:U32 -> @+acc:List<&2, U32> -> PbStep
def Pb.body source · line 354 · raw
@+num:U32 -> @+left:U32 -> @acc:List<&2, U32> -> @last:Bool -> PbStep
def Pb.fix source · line 361 · raw
@+num:U32 -> @+wire:U32 -> @+left:U32 -> @+acc:List<&2, U32> -> @last:Bool -> PbStep
def Pb.step source · line 369 · raw
@st:PbSt -> @+b:U32 -> PbStep
One byte into the decoder.
def Pb.add source · line 380 · raw
@got:Maybe<&2, PbField> -> @out:List<&2, PbField> -> List<&2, PbField>
def Pb.fin source · line 388 · raw
@st:PbSt -> @out:List<&2, PbField> -> Result<&2, &2, String, List<&2, PbField>>
The end of the bytes: only between fields is a message whole.
def Pb.decode.go source · line 397 · raw
@bs:List<&2, U32> -> @ev:PbStep -> @out:List<&2, PbField> -> Result<&2, &2, String, List<&2, PbField>>
def Pb.decode source · line 406 · raw
@bs:List<&2, U32> -> Result<&2, &2, String, List<&2, PbField>>
A message's fields, in the order they came.
def Pb.varints.next source · line 415 · raw
@+b:U32 -> @+sh:U32 -> @acc:W64 -> @out:List<&2, W64> -> @last:Bool -> @long:Bool -> PbVs
def Pb.varints.fin source · line 424 · raw
@ev:PbVs -> Result<&2, &2, String, List<&2, W64>>
def Pb.varints.go source · line 433 · raw
@bs:List<&2, U32> -> @ev:PbVs -> Result<&2, &2, String, List<&2, W64>>
def Pb.varints source · line 443 · raw
@bs:List<&2, U32> -> Result<&2, &2, String, List<&2, W64>>
The varints of a packed repeated field.
def Pb.pick source · line 452 · raw
@v:PbVal -> @last:Maybe<&2, PbVal> -> @hit:Bool -> Maybe<&2, PbVal>
def Pb.keep source · line 459 · raw
@v:PbVal -> @rest:List<&2, PbVal> -> @hit:Bool -> List<&2, PbVal>
def Pb.get.go source · line 466 · raw
@msg:List<&2, PbField> -> @+num:U32 -> @last:Maybe<&2, PbVal> -> Maybe<&2, PbVal>
def Pb.get source · line 474 · raw
@msg:List<&2, PbField> -> @+num:U32 -> Maybe<&2, PbVal>
The last value of field num.
def Pb.all source · line 478 · raw
@msg:List<&2, PbField> -> @+num:U32 -> List<&2, PbVal>
Every value of field num, in order.
def Pb.as_u64 source · line 485 · raw
@m:Maybe<&2, PbVal> -> W64
def Pb.as_bytes source · line 496 · raw
@m:Maybe<&2, PbVal> -> List<&2, U32>
def Pb.get_u64 source · line 504 · raw
@msg:List<&2, PbField> -> @+num:U32 -> W64
uint64, int64, fixed64 (or a widened 32-bit field); 0 when absent.
def Pb.get_u32 source · line 508 · raw
@msg:List<&2, PbField> -> @+num:U32 -> U32
uint32, int32 or an enum: the low 32 bits.
def Pb.get_bool source · line 511 · raw
@msg:List<&2, PbField> -> @+num:U32 -> Bool
def Pb.get_bytes source · line 514 · raw
@msg:List<&2, PbField> -> @+num:U32 -> List<&2, U32>
def Pb.get_str source · line 517 · raw
@msg:List<&2, PbField> -> @+num:U32 -> String
def Pb.get_msg source · line 522 · raw
@msg:List<&2, PbField> -> @+num:U32 -> Result<&2, &2, String, List<&2, PbField>>
A nested message's fields: empty when absent, Fail when it does not decode.
def Pb.all_str.go source · line 525 · raw
@vs:List<&2, PbVal> -> List<&2, String>
def Pb.all_str source · line 533 · raw
@msg:List<&2, PbField> -> @+num:U32 -> List<&2, String>
A repeated string field.
def Pb.all_msg.go source · line 536 · raw
@vs:List<&2, PbVal> -> Result<&2, &2, String, List<&2, List<&2, PbField>>>
def Pb.all_msg source · line 547 · raw
@msg:List<&2, PbField> -> @+num:U32 -> Result<&2, &2, String, List<&2, List<&2, PbField>>>
A repeated message field, each element decoded.
def Pb.all_u64.one source · line 550 · raw
@v:PbVal -> Result<&2, &2, String, List<&2, W64>>
def Pb.all_u64.go source · line 557 · raw
@vs:List<&2, PbVal> -> Result<&2, &2, String, List<&2, W64>>
def Pb.all_u64 source · line 568 · raw
@msg:List<&2, PbField> -> @+num:U32 -> Result<&2, &2, String, List<&2, W64>>
A repeated varint field, packed or not (a reader must take both).
def Pb.str_map.go source · line 571 · raw
@ms:List<&2, List<&2, PbField>> -> List<&2, PbStr>
def Pb.get_str_map source · line 580 · raw
@msg:List<&2, PbField> -> @+num:U32 -> Result<&2, &2, String, List<&2, PbStr>>
A map<string, string>; a later entry for a key does not replace an earlier one here, so read it with the last one winning.