Distributed Applications in Programmable Switches