Anion-exchange mechanisms in bacteria