def batch.validation.decided

mylsm-lsm-store@0.6.0.1 · src/ByteDurableDb.bend:1743

import mylsm-lsm-store@0.6.0.1/src/ByteDurableDb.bend as ByteDurableDb
import Base
import mylsm-lsm-store@0.6.0.1/src/ByteMemTable.bend as ByteMemTable
import mylsm-lsm-store@0.6.0.1/src/ByteWal.bend as ByteWal
import mylsm-lsm-store@0.6.0.1/src/DurableBatchPolicy.bend as BatchPolicy

1743def batch.validation.decided(
1744  handle: Handle,
1745  entries: List<&1, ByteMemTable.Entry>,
1746  mutations: List<&1, ByteWal.Mutation>,
1747  validation: BatchPolicy.Validation
1748) -> IO(Handle & Result<&1, &1, Error, BatchPrepared>):
1749  match validation:
1750    case BatchPolicy.ValidBatch{}:
1751      batch.prepare(handle, mutations, entries)
1752    case BatchPolicy.BatchBytesExceeded{}:
1753      IO.pure(Handle & Result<&1, &1, Error, BatchPrepared>,
1754        (handle, Fail{ResourceLimit{}}))
1755    case BatchPolicy.BatchCountExceeded{}:
1756      IO.pure(Handle & Result<&1, &1, Error, BatchPrepared>,
1757        (handle, Fail{ResourceLimit{}}))
1758    case _:
1759      IO.pure(Handle & Result<&1, &1, Error, BatchPrepared>,
1760        (handle, Fail{InvalidArgument{}}))

Uses (13)

Used by (1)