Simplify the implementation of aimdb-sync - #208
Conversation
|
Thanks for this @fresheed, it's a solid piece of work. Deleting the six Two logistics notes before I do a detailed pass. Please rebase first
Resolution notes:
Verify with The Your questions
Shutdown not observed until the buffer drains. Keep it. Matching
Should
Re-measuring the overhead claim. Agreed on removing it and yes — separate issue. After the rebasePing me and I'll do the full pass. I have a handful of items queued, mostly around the producer docs still describing backpressure that the new |
Description
Note that some of existing/current behaviors are not entirely clear; I highlighted them below.
The changed made are:
SyncProducer
test_runtime_shutdown_error). If the underlying producer was pre-resolved (as brought up in discussion), it won't be that easy.set_with_timeoutSyncConsumer
WaiterandReader, as suggested in the issuetest_runtime_shutdown_after_produce_read_error. This is consistent with the behavior of tokio'sbroadcast.CloneandSyncimplementations are removedTgeneric&mut selfget_latest: if an error occurs after the initial read, the method returns the latest read value and not the error. Should we keep it that way?Waiter
Implemented as described in the issue for
stdfeaturehandle
producermethod cannot fail anymore. Should its signature be changed?newmethod is marked as legacy, but it's used byattach- what to do with that?subscribeunsafe implRemoved everywhere from
aimdb-sync. Now correspondingtestmodules contain some boilerplate to confirm that producer, consumer and handle implementSendandSync(the latter is not for consumer).I'm curious if it can be done with
static_assertionscrate instead.integration tests
getRuntimeShutdownon the non-blocking path too (try_set/try_getafterdetach()) —test_non_blocking_operationsandtest_runtime_shutdown_erroreach only covered half of itthread::sleep- everything is blocking now, and in multithreaded tests consumers block on producers anywaymutto consumerssettable_integrationwas NOT run bycargo testbefore due todata-contractsfeature. Making it run required changes in Cargo files - please check itexamples
mutto consumersprintln!summary: it advertisedset_timeoutas a producer capability (removed) and misnamedget_timeout(real name isget_with_timeout)documentation
lib.rs) to match the rewrite: per-type Send/Sync/Clone claims instead of a blanket "all types are Send + Sync" (Thread-Safe bullet,## Safetysection), the## Overview/## Threading Modelsections no longer describe a channel-based bridge (that's theblock_onseam now), and fixed two method names that never existed (get_timeout/set_timeout→get_with_timeout, and dropped theset_timeout()bullet since there's no timeout variant on the producer)error.rs's doc comment mentioned "channel timeouts" among the facade-specific failures — dropped, since neitherSetTimeout(buffer-full ontry_set) norGetTimeout(tokio timer / empty buffer) involve a channel anymoreRelated Issue
Closes #200
Checklist
make check).