Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
cc42bac5
Unverified
Commit
cc42bac5
authored
Jan 18, 2021
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shard director refactor: .shardd to local variable
parent
729e69be
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
vmod_directors_shard.c
vmod/vmod_directors_shard.c
+12
-11
No files found.
vmod/vmod_directors_shard.c
View file @
cc42bac5
...
@@ -595,6 +595,7 @@ VCL_BACKEND v_matchproto_(td_directors_shard_backend)
...
@@ -595,6 +595,7 @@ VCL_BACKEND v_matchproto_(td_directors_shard_backend)
vmod_shard_backend
(
VRT_CTX
,
struct
vmod_directors_shard
*
vshard
,
vmod_shard_backend
(
VRT_CTX
,
struct
vmod_directors_shard
*
vshard
,
struct
VARGS
(
shard_backend
)
*
a
)
struct
VARGS
(
shard_backend
)
*
a
)
{
{
struct
sharddir
*
shardd
;
struct
vmod_directors_shard_param
pstk
;
struct
vmod_directors_shard_param
pstk
;
struct
vmod_directors_shard_param
*
pp
=
NULL
;
struct
vmod_directors_shard_param
*
pp
=
NULL
;
const
struct
vmod_directors_shard_param
*
ppt
;
const
struct
vmod_directors_shard_param
*
ppt
;
...
@@ -603,6 +604,8 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
...
@@ -603,6 +604,8 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
vshard
,
VMOD_SHARD_SHARD_MAGIC
);
CHECK_OBJ_NOTNULL
(
vshard
,
VMOD_SHARD_SHARD_MAGIC
);
shardd
=
vshard
->
shardd
;
CHECK_OBJ_NOTNULL
(
shardd
,
SHARDDIR_MAGIC
);
assert
((
args
&
~
arg_mask_
)
==
0
);
assert
((
args
&
~
arg_mask_
)
==
0
);
if
(
args
&
arg_resolve
)
if
(
args
&
arg_resolve
)
...
@@ -619,7 +622,7 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
...
@@ -619,7 +622,7 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
}
}
if
((
ctx
->
method
&
SHARD_VCL_TASK_BEREQ
)
==
0
)
{
if
((
ctx
->
method
&
SHARD_VCL_TASK_BEREQ
)
==
0
)
{
shard_fail
(
ctx
,
vshard
->
shardd
->
name
,
"%s"
,
shard_fail
(
ctx
,
shardd
->
name
,
"%s"
,
".backend(resolve=LAZY) with other "
".backend(resolve=LAZY) with other "
"parameters can only be used in backend/pipe "
"parameters can only be used in backend/pipe "
"context"
);
"context"
);
...
@@ -627,24 +630,23 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
...
@@ -627,24 +630,23 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
}
}
}
else
if
(
resolve
==
VENUM
(
NOW
))
{
}
else
if
(
resolve
==
VENUM
(
NOW
))
{
if
(
ctx
->
method
&
VCL_MET_TASK_H
)
{
if
(
ctx
->
method
&
VCL_MET_TASK_H
)
{
shard_fail
(
ctx
,
vshard
->
shardd
->
name
,
"%s"
,
shard_fail
(
ctx
,
shardd
->
name
,
"%s"
,
".backend(resolve=NOW) can not be "
".backend(resolve=NOW) can not be "
"used in vcl_init{}/vcl_fini{}"
);
"used in vcl_init{}/vcl_fini{}"
);
return
(
NULL
);
return
(
NULL
);
}
}
pp
=
shard_param_stack
(
&
pstk
,
pp
=
shard_param_stack
(
&
pstk
,
pp
!=
NULL
?
pp
:
vshard
->
shardd
->
param
,
pp
!=
NULL
?
pp
:
shardd
->
param
,
vshard
->
shardd
->
name
);
shardd
->
name
);
}
else
{
}
else
{
WRONG
(
"resolve enum"
);
WRONG
(
"resolve enum"
);
}
}
if
(
ctx
->
method
&
SHARD_VCL_TASK_BEREQ
)
{
if
(
ctx
->
method
&
SHARD_VCL_TASK_BEREQ
)
{
pp
=
shard_param_task_l
(
ctx
,
vshard
->
shardd
,
pp
=
shard_param_task_l
(
ctx
,
shardd
,
shardd
->
param
);
vshard
->
shardd
->
param
);
if
(
pp
==
NULL
)
if
(
pp
==
NULL
)
return
(
NULL
);
return
(
NULL
);
pp
->
vcl_name
=
vshard
->
shardd
->
name
;
pp
->
vcl_name
=
shardd
->
name
;
}
}
AN
(
pp
);
AN
(
pp
);
...
@@ -652,7 +654,7 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
...
@@ -652,7 +654,7 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
if
(
args
&
arg_param
)
{
if
(
args
&
arg_param
)
{
ppt
=
shard_param_blob
(
a
->
param
);
ppt
=
shard_param_blob
(
a
->
param
);
if
(
ppt
==
NULL
)
{
if
(
ppt
==
NULL
)
{
shard_fail
(
ctx
,
vshard
->
shardd
->
name
,
"%s"
,
shard_fail
(
ctx
,
shardd
->
name
,
"%s"
,
".backend(key_blob) param invalid"
);
".backend(key_blob) param invalid"
);
return
(
NULL
);
return
(
NULL
);
}
}
...
@@ -671,9 +673,8 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
...
@@ -671,9 +673,8 @@ vmod_shard_backend(VRT_CTX, struct vmod_directors_shard *vshard,
assert
(
resolve
==
VENUM
(
NOW
));
assert
(
resolve
==
VENUM
(
NOW
));
shard_param_merge
(
pp
,
pp
->
defaults
);
shard_param_merge
(
pp
,
pp
->
defaults
);
return
(
sharddir_pick_be
(
ctx
,
vshard
->
shardd
,
return
(
sharddir_pick_be
(
ctx
,
shardd
,
shard_get_key
(
ctx
,
pp
),
shard_get_key
(
ctx
,
pp
),
pp
->
alt
,
pp
->
warmup
,
pp
->
alt
,
pp
->
warmup
,
pp
->
rampup
,
pp
->
healthy
));
pp
->
rampup
,
pp
->
healthy
));
}
}
static
VCL_BOOL
v_matchproto_
(
vdi_healthy
)
static
VCL_BOOL
v_matchproto_
(
vdi_healthy
)
...
...
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