Safe, Sequential And Scalable Counters In Mnesia

前端 未结 4 1488
旧时难觅i
旧时难觅i 2021-02-11 04:44

I am writing an application in Erlang/OTP and want to use sequential counters on a version recording system.

I first implemented them with

mnesia:dirty_update_count         


        
4条回答
  •  余生分开走
    2021-02-11 05:23

    Have you though about a Message Broker? You could keep it in Erlang by loading up RabbitMQ and setting up a durable queue and persistent messages. Build a consumer that increments a number in the message body by 1 then publishes that new number back to the queue in a new message as it acks the original one.

    Not sure it would work for you but it seems like once you manually publish the first message with 1 in the body you would be off and running.

提交回复
热议问题