def source.step.result

mylsm-lsm-store@0.6.0.1 · src/transfer/BackupOwnerCursorIo.bend:90

import mylsm-lsm-store@0.6.0.1/src/transfer/BackupOwnerCursorIo.bend as BackupOwnerCursorIo
import Base
import mylsm-lsm-store@0.6.0.1/src/coordinator/Client.bend as Client
import mylsm-lsm-store@0.6.0.1/src/coordinator/CursorCodec.bend as CursorCodec
import mylsm-lsm-store@0.6.0.1/src/transfer/BackupCursor.bend as BackupCursor

90def source.step.result(
91  source: OwnerSource,
92  stream: BackupCursor.Stream,
93  pair: Client.Session & Result<&1, &1, Client.Error, CursorCodec.Frame>
94) -> OwnerSource & BackupCursor.Step:
95  match source:
96    case OwnerSource{_, snapshot_id, cursor_id, cursor_live}:
97      match pair:
98        case (session, Fail{error}):
99          (OwnerSource{session, snapshot_id, cursor_id, cursor_live},
100            BackupCursor.Failure{None{},
101              source.error(error)})
102        case (session, Done{frame}):
103          match frame:
104            case CursorCodec.CursorEnd{}:
105              (OwnerSource{session, snapshot_id, cursor_id, False{}},
106                BackupCursor.advance.owner(stream, frame))
107            case CursorCodec.CursorItem{_, _}:
108              (OwnerSource{session, snapshot_id, cursor_id, True{}},
109                BackupCursor.advance.owner(stream, frame))

Uses (13)

Used by (1)