[zeromq-dev] Reimplementation of the zring class with equipotent API

Pieter Hintjens ph at imatix.com
Sat Sep 27 08:26:09 CEST 2014


I rejected your PR.

More explanation in my comment on github.

Please try to solve atomic problems we agree on and then make minimal
solutions to them. Yesterday I described "thrashing". Your PR is a
great example of thrashing. Please stop it, it is not enjoyable.

*** Minimal solutions to agreed problems. ***

I'd suggest you print that out and stick it on your keyboard and
re-read it every time you make a pull request.

-Pieter

On Sat, Sep 27, 2014 at 7:08 AM, Goswin von Brederlow <goswin-v-b at web.de> wrote:
> Hi,
>
> I just send a pull request for a reimplementation of the zring class
> with a new API:
>
>     https://github.com/zeromq/czmq/pull/698
>
> Note: I renamed the existing zring class to zhashring in case that is
> still wanted by others.
>
> The ztimeout class, for which I write the initial zring class, needs a
> method do directly remove/move elements of the ring. With the inital
> API this exposes internas of the implementation and needs a dangerous
> zring_goto mothod. So it was time to try something different.
>
> The new zring API uses the zring_t type for each element in the ring.
> In fact each element is a zring_t, they are all equipotent. Given any
> element you can add, remove, iterate, ... to the ring. And elements
> can be moved safely from one ring to another (or within the same
> ring). Instead of a special head structure every element of the ring
> can function as head. That means you have to have an item in the ring
> for there to be a ring. An empty ring is just a NULL pointer.
>
> But sometimes one needs to have a head for an empty ring (to set the
> destructor and duplicator even though the ring is empty). For this I
> defined guard elements. A guard element is simply an element in the
> ring that has NULL as item pointer. Otherwise they are like any other
> element of the ring.
>
> Except for zring_first/zring_next. Both of them skip over guard
> elements and only return elements with a real item. And yes, I said
> "elements". You can have more than one guard in a ring, splitting them
> into sections. Zring_first and zring_next allow iterating until the
> next guard, once around the ring or until any specific element is
> reached.
>
> For an example of how zring can be used look at ztimeout. This
> includes use of multiple guard elements and the different iterator
> modes.
>
> MfG
>         Goswin
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev



More information about the zeromq-dev mailing list