trimEvents :: HasLogFunc e => EventLog -> Word64 -> RIO e ()
trimEvents log start = do
    last <- lastEv log
    rwith (writeTxn $ env log) $ \txn ->
        for_ [start..last] $ \eId ->
        withWordPtr eId $ \pKey -> do
            let key = MDB_val 8 (castPtr pKey)
            found <- io $ mdb_del txn (eventsTbl log) key Nothing
            unless found $
                throwIO (MissingEvent eId)
    writeIORef (numEvents log) (pred start)
trimEvents :: HasLogFunc e => EventLog -> Word64 -> RIO e ()
trimEvents log start = do
    last <- lastEv log
    rwith (writeTxn $ env log) $ \txn ->
        for_ [start..last] $ \eId ->
        withWordPtr eId $ \pKey -> do
            let key = MDB_val 8 (castPtr pKey)
            found <- io $ mdb_del txn (eventsTbl log) key Nothing
            unless found $
                throwIO (MissingEvent eId)
    writeIORef (numEvents log) (pred start)
trimEvents log start = do
    last <- lastEv log
    rwith (writeTxn $ env log) $ \txn ->
        for_ [start..last] $ \eId ->
        withWordPtr eId $ \pKey -> do
            let key = MDB_val 8 (castPtr pKey)
            found <- io $ mdb_del txn (eventsTbl log) key Nothing
            unless found $
                throwIO (MissingEvent eId)
    writeIORef (numEvents log) (pred start)