Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-cluster
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-cluster
Commits
1242b52b
Commit
1242b52b
authored
Jul 30, 2018
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add .get_cluster()
parent
278c5746
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
vmod_cluster.c
src/vmod_cluster.c
+12
-0
vmod_cluster.vcc
src/vmod_cluster.vcc
+4
-0
cfg.vtc
src/vtc/cfg.vtc
+6
-1
No files found.
src/vmod_cluster.c
View file @
1242b52b
...
...
@@ -360,6 +360,18 @@ vmod_cluster_set_real(VRT_CTX,
pl
->
real
=
b
;
}
VCL_BACKEND
vmod_cluster_get_cluster
(
VRT_CTX
,
struct
vmod_cluster_cluster
*
vc
)
{
const
struct
vmod_cluster_cluster_param
*
pr
;
CHECK_OBJ_NOTNULL
(
vc
,
VMOD_CLUSTER_CLUSTER_MAGIC
);
pr
=
cluster_task_param_r
(
ctx
,
vc
);
return
(
pr
->
cluster
);
}
VCL_BACKEND
vmod_cluster_get_real
(
VRT_CTX
,
struct
vmod_cluster_cluster
*
vc
)
{
...
...
src/vmod_cluster.vcc
View file @
1242b52b
...
...
@@ -147,6 +147,10 @@ Change the real backend.
See :ref:`meth_ctx` for limitations.
$Method BACKEND .get_cluster()
Return the `cluster` argument.
$Method BACKEND .get_real()
Return the currently configured real backend.
...
...
src/vtc/cfg.vtc
View file @
1242b52b
...
...
@@ -69,6 +69,7 @@ varnish v1 -vcl+backend {
sub vcl_synth {
set resp.http.b1 = cl.backend(resolve=NOW);
set resp.http.b2 = cl.backend(resolve=NOW);
set resp.http.cl = cl.get_cluster();
}
sub vcl_backend_fetch {
...
...
@@ -112,6 +113,7 @@ varnish v1 -vcl+backend {
}
sub vcl_backend_response {
set beresp.http.backend = beresp.backend;
set beresp.http.cl = cl.get_cluster();
}
} -start
...
...
@@ -175,16 +177,19 @@ client c1 {
expect resp.status == 200
expect resp.http.b1 == s1
expect resp.http.b2 == s3
expect resp.http.cl == rr
txreq
rxresp
expect resp.status == 200
expect resp.http.backend == "s1"
expect resp.http.cl == rr
txreq
rxresp
expect resp.status == 200
expect resp.http.backend == "s3"
expect resp.http.cl == rr
} -run
logexpect l1 -wait
\ No newline at end of file
logexpect l1 -wait
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment