Algorithm-ConsistentHash-Ketama

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    * Add hash_with_hashnum(), label_from_hashnum(). This allows clients to
      cache the hashed values -- thus avoiding the need to recompute the
      MD5 hash. However, you should make sure you know what you're doing
      before using these (Steffen Mueller)
      (https://github.com/lestrrat/Algorithm-ConsistentHash-Ketama/pull/1)

0.00007 - Jun 3 2010
    * How about actually using ppport.h?

0.00006 - May 18 2010
    * Fix cloning problems under threads 

0.00005 - May 09 2010
    * Remove superfulous code from constructor

0.00004 - May 09 2010
    * Fix memory leak

0.00003 - May 08 2010
    * Add bunch of thread safety changes

0.00002 - May 03 2010
    * Upload previous changes as 0.00002
    * Add author tests
    * Hide some XS methods
    * Add more for Bucket.pm

0.00001_03 - May 03 2010
    * Allocate temporary variable continuum on heap instead of on stack
    * Attempt to include math.h explicitly

MANIFEST  view on Meta::CPAN

t/002_consistent_hash.t
t/003_dgryski.t
t/900_issue3.t
xs/Ketama.h
xs/Ketama.xs
xs/KetamaMD5.c
xs/KetamaMD5.h
xs/typemap
xt/01_pod.t
xt/02_pod-coverage.t
xt/03_threads.t
xt/04_leak.t

xs/Ketama.xs  view on Meta::CPAN

            }
        }
        newketama->numbuckets = ketama->numbuckets;
    }
    return newketama;
}

static int
PerlKetama_mg_dup(pTHX_ MAGIC* const mg, CLONE_PARAMS* const param){
    PERL_UNUSED_VAR(param);
#ifdef USE_ITHREADS /* single threaded perl has no "xxx_dup()" APIs */
    PerlKetama* const ketama = (PerlKetama*)mg->mg_ptr;
    mg->mg_ptr = (char *) PerlKetama_clone(ketama);
#else
    PERL_UNUSED_VAR(mg);
#endif
    return 0;
}

static MGVTBL PerlKetama_vtbl = { /* for identity */
    NULL, /* get */

xt/03_threads.t  view on Meta::CPAN

use strict;
use Test::More;
use Test::Requires 'threads';
use_ok "Algorithm::ConsistentHash::Ketama";

my $x = Algorithm::ConsistentHash::Ketama->new; 
my @threads;
for (1..5) {
    push @threads, threads->create(sub{
        note( "spawned thread : " . threads->tid() );
    });
}

foreach my $thr (@threads) {
    note( "joining thread : " . $thr->tid );
    $thr->join;
}

ok(1);
done_testing();



( run in 0.686 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )