def response.payload.result

mylsm-lsm-store@0.6.0.1 · src/coordinator/Io.bend:631

import mylsm-lsm-store@0.6.0.1/src/coordinator/Io.bend as Io
import Base
import mylsm-lsm-store@0.6.0.1/src/coordinator/Protocol.bend as Protocol
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

631def response.payload.result(
632  header: Bytes.Bytes,
633  pair: File & Result<&1, &1, U32 & String, ExactResult>
634) -> IO(File & Result<&1, &1, Error, Protocol.Response>):
635  match pair:
636    case (file, Fail{(code, message)}):
637      IO.pure(File & Result<&1, &1, Error, Protocol.Response>,
638        (file, Fail{host.error(code, message)}))
639    case (file, Done{ExactResult{bytes, complete}}):
640      match complete:
641        case False{}:
642          IO.pure(File & Result<&1, &1, Error, Protocol.Response>,
643            (file, Fail{Truncated{}}))
644        case True{}:
645          IO.pure(File & Result<&1, &1, Error, Protocol.Response>,
646            response.frame.result(file,
647              Protocol.decode_response(Bytes.concat([header, bytes]),
648                max_payload_bytes())))

Uses (19)

Used by (1)