Hi Everyone. I had a question.
For shared KMP services/managers that perform real I/O like DataStore, DB, files, or network, what should our team standard be for dispatcher ownership?
Options to align on
1. Caller-owned threading
Low-level managers/services stay dumb, and every caller must invoke them from the correct dispatcher (
Dispatchers.IO, etc.).
2. Callee-owned threading
Any low-level class that performs I/O must enforce safe execution internally, usually via injected dispatchers.
3. Mixed rule by layer
Pure repositories/services can stay dumb, but storage/persistence boundaries like DataStore/DB/file access must enforce their own dispatcher internally.
Follow-up questions
- Should this standard be the same for Android and iOS/KMP interop paths?
- Do we want convention-based safety or contract-based safety for disk/database I/O?
- If dispatchers are enforced internally, should we inject them for testability?
- Should Swift/KMP bridges stay thin, or can they own platform-specific dispatcher fixes?