~/bend-docscommunity

src/coordinator/Io.bend relies on unsafe/foreign

raw source on the hub · import mylsm-lsm-store@0.6.0.1/src/coordinator/Io.bend as Io

6 imports
import Base
import ../ByteMemTable.bend as ByteMemTable
import ./Protocol.bend as Protocol
import ./IoPolicy.bend as IoPolicy
import ./UnixSocketPolicy.bend as UnixSocketPolicy
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

Types

type Error source · line 9 · raw

Data

Classifies framing, resource, and host failures from socket IO.

type ExactResult source · line 22 · raw

Type

Returns the terminal outcome of an exact-length socket transfer.

type ReadAttempt source · line 26 · raw

Type

Carries the state for ReadAttempt.

type WriteAttempt source · line 33 · raw

Type

Carries the state for WriteAttempt.

type ExactState source · line 40 · raw

Type

Tracks partial transfer progress until the requested length is complete.

type WriteState source · line 46 · raw

Type

Carries bounded chunks through one-syscall socket write steps.

Definitions

def max_payload_bytes source · line 61 · raw

Nat

Sets the protocol payload ceiling enforced before socket allocation.

def host.error.classified source · line 64 · raw

@code:U32 -> @message:String -> @classification:0xdd46804cd6318755b753109f15ff3725/src/coordinator/UnixSocketPolicy.Classification -> Error

def host.error.copies source · line 74 · raw

@copies:Pair(U32, Pair(U32, U32)) -> @message:String -> Error

def host.error source · line 83 · raw

@code:U32 -> @message:String -> Error

def read.words source · line 96 · raw

@file:File -> @max_bytes:U32 -> IO(Pair(File, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>))

def read.wrap source · line 104 · raw

@result:Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)> -> Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>

def read.pair source · line 111 · raw

@pair:Pair(File, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>) -> Pair(File, Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>)

def read.bytes source · line 117 · raw

@file:File -> @max_bytes:U32 -> IO(Pair(File, Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>))

def read.nonblocking.classified source · line 128 · raw

@file:File -> @+code:U32 -> @message:String -> @disposition:0xdd46804cd6318755b753109f15ff3725/src/coordinator/IoPolicy.ReadDisposition -> Pair(File, ReadAttempt)

def read.nonblocking.failed source · line 140 · raw

@file:File -> @pair:Pair(U32, String) -> Pair(File, ReadAttempt)

def read.nonblocking.result source · line 149 · raw

@pair:Pair(File, Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>) -> Pair(File, ReadAttempt)

def read.nonblocking source · line 156 · raw

@file:File -> @max_bytes:U32 -> IO(Pair(File, ReadAttempt))

def write.nonblocking.classified source · line 176 · raw

@file:File -> @bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @+code:U32 -> @message:String -> @disposition:0xdd46804cd6318755b753109f15ff3725/src/coordinator/IoPolicy.WriteDisposition -> Pair(File, WriteAttempt)

def write.nonblocking.failed source · line 191 · raw

@file:File -> @bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @error:Pair(U32, String) -> Pair(File, WriteAttempt)

def write.nonblocking.wrap source · line 201 · raw

@pair:Pair(File, Pair(Array<U32>, Result<&1, &1, Pair(U32, String), U32>)) -> @total:U32 -> Pair(File, WriteAttempt)

def write.nonblocking.start source · line 213 · raw

@file:File -> @offset:U32 -> @length:U32 -> @total:U32 -> @words:Array<U32> -> IO(Pair(File, WriteAttempt))

def write.nonblocking source · line 225 · raw

@file:File -> @offset:U32 -> @length:U32 -> @bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> IO(Pair(File, WriteAttempt))

def write.words source · line 235 · raw

@file:File -> @offset:U32 -> @length:U32 -> @words:Array<U32> -> IO(Pair(File, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>))

def write.chunk source · line 243 · raw

@remaining:U32 -> U32

def write.advance.total source · line 256 · raw

@copies:Pair(U32, Pair(U32, U32)) -> @file:File -> @offset:U32 -> @remaining:U32 -> @words:Array<U32> -> WriteState

def write.advance source · line 269 · raw

@zero:Bool -> @file:File -> @total:U32 -> @offset:U32 -> @remaining:U32 -> @sent_offset:U32 -> @sent_remaining:U32 -> @words:Array<U32> -> WriteState

def write.need source · line 286 · raw

@zero:Bool -> @file:File -> @remaining_send:U32 -> @total:U32 -> @offsets:Pair(U32, Pair(U32, U32)) -> @bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> WriteState

def write.loop source · line 305 · raw

@fuel:Nat -> @state:WriteState -> IO(Pair(File, Result<&1, &1, Pair(U32, String), Unit>))

def write.start.total source · line 373 · raw

@file:File -> @words:Array<U32> -> @fuel_length:U32 -> @remaining_seed:U32 -> @total_copies:Pair(U32, Pair(U32, U32)) -> IO(Pair(File, Result<&1, &1, Pair(U32, String), Unit>))

def write.start.copies source · line 386 · raw

@file:File -> @words:Array<U32> -> @copies:Pair(U32, Pair(U32, U32)) -> IO(Pair(File, Result<&1, &1, Pair(U32, String), Unit>))

def write.start source · line 396 · raw

@file:File -> @length:U32 -> @words:Array<U32> -> IO(Pair(File, Result<&1, &1, Pair(U32, String), Unit>))

def write_all source · line 404 · raw

@file:File -> @bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> IO(Pair(File, Result<&1, &1, Pair(U32, String), Unit>))

Completes a frame by advancing over bounded partial writes.

def exact.complete source · line 414 · raw

@file:File -> @chunks:List<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> @complete:Bool -> IO(Pair(File, Result<&1, &1, Pair(U32, String), ExactResult>))

def exact.loop source · line 423 · raw

@fuel:Nat -> @state:ExactState -> IO(Pair(File, Result<&1, &1, Pair(U32, String), ExactResult>))

def exact.nat.duplicate.step source · line 469 · raw

@pair:Pair(Nat, Nat) -> Pair(Nat, Nat)

def exact.nat.duplicate source · line 473 · raw

@value:Nat -> Pair(Nat, Nat)

def exact.start.copied source · line 478 · raw

@file:File -> @copies:Pair(Nat, Nat) -> IO(Pair(File, Result<&1, &1, Pair(U32, String), ExactResult>))

def exact.start source · line 488 · raw

@file:File -> @needed:Nat -> IO(Pair(File, Result<&1, &1, Pair(U32, String), ExactResult>))

def frame.error source · line 496 · raw

@decision:0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.FrameDecision -> Error

def frame.result source · line 502 · raw

@file:File -> @decision:0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.FrameDecision -> Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Request>)

def payload.result source · line 510 · raw

@header:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @pair:Pair(File, Result<&1, &1, Pair(U32, String), ExactResult>) -> @max_payload:Nat -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Request>))

def payload.header source · line 529 · raw

@file:File -> @header:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @length:U32 -> @max_payload:Nat -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Request>))

def header.length source · line 540 · raw

@file:File -> @bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @length:Maybe<&2, U32> -> @max_payload:Nat -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Request>))

def header.length.result source · line 552 · raw

@file:File -> @pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Maybe<&2, U32>) -> @max_payload:Nat -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Request>))

def header.decision source · line 560 · raw

@file:File -> @bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @decision:0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.FrameDecision -> @max_payload:Nat -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Request>))

def header.cloned source · line 573 · raw

@file:File -> @pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes) -> @+max_payload:Nat -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Request>))

def header.result source · line 583 · raw

@pair:Pair(File, Result<&1, &1, Pair(U32, String), ExactResult>) -> @max_payload:Nat -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Request>))

def read_request.limited source · line 599 · raw

@file:File -> @max_payload:Nat -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Request>))

def read_request source · line 611 · raw

@file:File -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Request>))

Reads and validates one length-bounded request frame.

def response.frame.result source · line 618 · raw

@file:File -> @decision:0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.ResponseDecision -> Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Response>)

def response.payload.result source · line 631 · raw

@header:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @pair:Pair(File, Result<&1, &1, Pair(U32, String), ExactResult>) -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Response>))

def response.payload source · line 650 · raw

@file:File -> @header:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @length:U32 -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Response>))

def response.length.admitted source · line 660 · raw

@file:File -> @header:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @length:U32 -> @admitted:Bool -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Response>))

def response.length.checked source · line 672 · raw

@file:File -> @header:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @lengths:Pair(U32, Pair(U32, U32)) -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Response>))

def response.length source · line 682 · raw

@file:File -> @header:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @length:Maybe<&2, U32> -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Response>))

def response.header.length source · line 695 · raw

@file:File -> @pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Maybe<&2, U32>) -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Response>))

def response.header.complete source · line 702 · raw

@file:File -> @header:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @complete:Bool -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Response>))

def response.header.result source · line 714 · raw

@pair:Pair(File, Result<&1, &1, Pair(U32, String), ExactResult>) -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Response>))

def read_response source · line 725 · raw

@file:File -> IO(Pair(File, Result<&1, &1, Error, 0xdd46804cd6318755b753109f15ff3725/src/coordinator/Protocol.Response>))

Reads and validates one length-bounded response frame.

Effects (foreign code)

effect unix_socket_read source · line 87 · raw

@file:File -> @max_bytes:U32 -> IO(Pair(File, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>))

Reads one raw byte chunk from an accepted local socket.

foreign: src/effs/unix_socket_read.c, src/effs/unix_socket_read.js

effect unix_socket_write_nonblocking source · line 166 · raw

@file:File -> @offset:U32 -> @length:U32 -> @words:Array<U32> -> IO(Pair(File, Pair(Array<U32>, Result<&1, &1, Pair(U32, String), U32>)))

Handles unix socket write nonblocking.

foreign: src/effs/unix_socket_write_nonblocking.c, src/effs/unix_socket_write_nonblocking.js

effect unix_socket_write source · line 247 · raw

@file:File -> @offset:U32 -> @length:U32 -> @words:Array<U32> -> IO(Pair(File, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>))

Writes one raw byte chunk to a local socket connection.

foreign: src/effs/unix_socket_write.c, src/effs/unix_socket_write.js