A minimal process ring buffer to supervise and rotate on processes. It’s like a process pool except that you don’t keep hold of a process when you fetch one from a buffer.
toveri:new(RingBufName, Size) -> {ok, Pid} | {error, Reason} RingBufName = atom() Size = non_neg_integer() Pid = pid() Reason = {already_started, Pid}
toveri:delete(RingBufName) -> ok RingBufName = atom()
add_child(RingBufName, MFA) -> ok add_child(RingBufName, MFA, Count) -> ok RingBufName = atom() MFA = mfa() Count = non_neg_integer()
toveri:get_size(RingBufName) -> {ok, Size} | {error, Reason} RingBufName = atom() Size = non_neg_integer() Reason = no_such_ring
toveri:get_pid(RingBufName) -> {ok, Pid} | {error, Reason} RingBufName = atom() Pid = pid() Pos = non_neg_integer() Reason = no_such_ring | {empty, Pos}
toveri:get_pid(RingBufName, Pos) -> {ok, Pid} | {error, Reason} RingBufName = atom() Pid = pid() Pos = non_neg_integer() Reason = no_such_ring | {empty, Pos}