forked from memcached/memcached
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`-o proxy_config=routelib` will use the binary-distributed routelib library
- Loading branch information
Showing
7 changed files
with
4,368 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- Minimal configuration. | ||
pools{ | ||
main = { | ||
backends = { | ||
"127.0.0.1:12181", | ||
} | ||
} | ||
} | ||
|
||
routes{ | ||
default = route_direct{ child = "main" } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use FindBin qw($Bin); | ||
use lib "$Bin/lib"; | ||
use Carp qw(croak); | ||
use MemcachedTest; | ||
use IO::Socket qw(AF_INET SOCK_STREAM); | ||
use IO::Select; | ||
use Data::Dumper qw/Dumper/; | ||
|
||
if (!supports_proxy()) { | ||
plan skip_all => 'proxy not enabled'; | ||
exit 0; | ||
} | ||
|
||
my $t = Memcached::ProxyTest->new(servers => [12181]); | ||
|
||
my $p_srv = new_memcached('-o proxy_config=routelib,proxy_arg=./t/proxyroutelib.lua -t 1'); | ||
my $ps = $p_srv->sock; | ||
$ps->autoflush(1); | ||
|
||
$t->set_c($ps); | ||
$t->accept_backends(); | ||
|
||
my $w = $p_srv->new_sock; | ||
print $w "watch proxyevents\r\n"; | ||
is(<$w>, "OK\r\n"); | ||
|
||
# We don't intend to test routelib here, just ensure that the embedding works | ||
# and this obviously routelib config starts. | ||
|
||
subtest 'basic' => sub { | ||
$t->c_send("mg test\r\n"); | ||
$t->be_recv(0, "mg test\r\n"); | ||
$t->be_send(0, "HD\r\n"); | ||
$t->c_recv_be(); | ||
$t->clear(); | ||
}; | ||
|
||
done_testing(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
generated by: | ||
xxd -i routelib.lua | perl -p -e 's/unsigned/const/' > routelib.h |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.