You need another data structure, look it
https://en.wikipedia.org/wiki/Bloom_filter
It is a probabilistic data structure that provide a efficient way to test 
if a element is in a set or not. Useful to implement idempotent behavior

On Tuesday, August 18, 2015 at 4:36:36 PM UTC-3, Grzegorz Duszyński wrote:
>
> I'm evaluating an approach to domain service idempotency using HyperLogLog 
> [*HLL*].
>
> Aim of this approach would be to provide generic way of ensuring 
> idempotency without storing large amounts of useless information. Only 
> requirement being tolerance for occasional duplication (send 2 email 
> instead of one).
>
> In my scenario every service request is a message object with toHashCode 
> function. The algorithm looks like this:
>
>
>    1. Upon receiving *request* domain service calculates HLL[*S1*] 
>    cardinality and stores it as *C1*.
>    2. *Request* hash[*H*] is added to the *copy* of HLL[*S2*] and the 
>    cardinality is stored as *C2*.
>    3. If *C1 == C2* then request is duplicated and *S2* should be 
>    discarded.
>    4. Otherwise request will be handled and hash[*H*] will be added to 
>    HLL[*S1*].
>
> Did anybody encounter similar solution ? 
> What would be the downsides of this kind of solution ?
>
> Originally posted:
>
> http://stackoverflow.com/questions/32074637/probabilistic-domain-service-idempotency-with-hyperloglog
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to