Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 34 lines (27 sloc) 1.011 kB
2c6284c @RJ initial checkin from private svn
authored
1 <?php
2 echo "Starting\n";
3
4 // try loading server definitions from specified file.
5 // ketama_roll will automatically re-read the contents
6 // whenever the file changes.
7 $continuum1 = ketama_roll( "ketama.servers" );
8 if ( !$continuum1 )
9 die( "Continuum one doesn't exist!\n" );
10
11 $continuum2 = ketama_roll( "ketama.two.servers" );
12 if ( !$continuum2 )
13 die( "Continuum two doesn't exist!\n" );
14
15 // find the matching server for key $i in the continuum
16 // specified by resource $continuum.
17 for ( $i = 0; $i < 25; $i++ )
18 {
19 $server = ketama_get_server( $i, $continuum1 );
20 echo "Continuum 1: Key " .$i. " is mapped to server " . $server[ "ip" ] . " ".
21 "at point: " . $server[ "point" ] . "\n";
22
23 $server = ketama_get_server( $i, $continuum2 );
24 echo "Continuum 2: Key " .$i. " is mapped to server " . $server[ "ip" ] . " ".
25 "at point: " . $server[ "point" ] . "\n";
26 }
27
28 // not strictly needed (will be auto-cleaned)
29 ketama_destroy( $continuum1 );
30 ketama_destroy( $continuum2 );
31
32 echo "Finished\n";
33 ?>
Something went wrong with that request. Please try again.