Communicating systems comprise diverse software components across networks. To ensure their robustness, modern programming languages such as Rust provide both strongly typed channels, whose usage is guaranteed to be affine (at most once), and cancellation operations over binary channels. For coordinating components to correctly communicate and synchronise with each other, we use the structuring mechanism from multiparty session types, extending it with affine communication channels and implicit/explicit cancellation mechanisms. This new typing discipline, affine multiparty session types (AMPST), ensures cancellation termination of multiple, independently running components and guarantees that communication will not get stuck due to error or abrupt termination. Guided by AMPST, we implemented an automated generation tool (MultiCrusty) of Rust APIs associated with cancellation termination algorithms, by which the Rust compiler auto-detects unsafe programs. Our evaluation shows that MultiCrusty provides an efficient mechanism for communication, synchronisation and propagation of the notifications of cancellation for arbitrary processes. We have implemented several usecases, including popular application protocols (OAuth, SMTP), and protocols with exception handling patterns (circuit breaker, distributed logging).
翻译:为确保其稳健性,Rust等现代编程语言既提供强烈打印的频道,保证其使用为折合(最多一次),又在二进制频道上进行取消操作。为了协调各组成部分以正确沟通和同步,我们使用了多会话类型的结构机制,扩大了多党会话的通信渠道和隐含/显性取消机制。这种新的打字纪律、交会类型(AMPST)确保取消多个独立运行的组件,并保证通信不会因错误或突然终止而卡住。在AMPST的指导下,我们实施了与取消算法相关的Rust APIs自动生成工具(MultiCruty),通过该工具,Rust编程自动检测不安全程序。我们的评估表明,多Cructy为任意程序的取消通知的通信、同步和传播提供了一个高效机制。我们实施了几种使用案例,包括通用应用协议(OAuth、SMTP)和例外处理模式的协议(断路、分布式记录)。