February 2022 Summaries
2 posts from Ditto
Filter
Month:
Year:
Post Summaries
Back to Blog
Ditto, a company that heavily utilizes asynchronous Rust for networking code, has developed an internal library called `ditto_time` to address the challenges of testing asynchronous code with timers. Traditional methods of testing async code can lead to non-deterministic and slow tests, which can cause unreliable CI/CD processes. The `ditto_time` library abstracts over `std::time` and Tokio's timer functions, allowing tests to execute almost instantly and deterministically by advancing mock time rather than real time. This approach ensures that async code, such as that involving timers, can be tested as-is, reflecting real-world scenarios without the drawbacks of conventional testing methods. The library employs thread-local storage to handle multiple concurrent tests and uses a `TimeControl` instance to manage mock timers, which aids in maintaining the integrity of test environments. By using this technique, Ditto can efficiently test its async business logic directly, benefiting both the company and its customers by avoiding unnecessary segmentation of code into synchronous and asynchronous components.
Feb 09, 2022
1,601 words in the original blog post.
Ditto is a versatile platform designed to function as both a local and a syncing database, offering developers the flexibility to use it in various applications without necessitating network configurations. It supports seamless document storage and retrieval using programming languages like Swift and Android, with the capability to run live queries on local instances. Users can operate multiple Ditto instances simultaneously, catering to distinct needs such as local data storage or data synchronization across devices. While Ditto excels in replication and mesh networking, it currently lacks features like indexing and non-CRDT serialization, although these are under development. The platform's JavaScript SDK is limited to in-memory operations in web browsers, but persistent storage is available in NodeJS and Electron environments. Ditto powers applications like Vaxx, a vaccine card app with 55,000 users, showcasing its functionality as a local database. Despite some feature gaps compared to databases like SQLite, Ditto is focusing its engineering efforts on enhancing replication performance and mesh networking capabilities.
Feb 08, 2022
1,169 words in the original blog post.