def read.loop
bend-kit-redis@0.3.0.0 · redis.bend:775
import bend-kit-redis@0.3.0.0/redis.bend as Redis
import Base
775
776def read.loop(fuel: Nat, st: Rd) -> IO(Result<&1, &1, Failure, Conn & Val>):
777 match fuel:
778 case 0n:
779 match st:
780 case RNext{tls, sock, key, ms, r}:
781 read.fail(tls, sock, Malformed{})
782 case RFail{tls, sock, why}:
783 read.fail(tls, sock, why)
784 case 1n+f:
785 match st:
786 case RFail{tls, sock, why}:
787 read.fail(tls, sock, why)
788 case RNext{+tls, sock, +key, +ms, r}:
789 (rd, nx) = r
790 match nx:
791 case Got{v}:
792 IO.pure(Result<&1, &1, Failure, Conn & Val>, Done{(Conn{tls, sock, rd, key, ms}, v)})
793 case Broken{}:
794 read.fail(tls, sock, Malformed{})
795 case Want{}:
796 do IO<Result<&1, &1, Failure, Conn & Val>>:
797 m : Socket & Result<&1, &1, U32 & String, U32 & Array<U32>> <- io.recv(tls, sock, ms)
798 read.loop(f, got(tls, key, ms, rd, m))