Commit 4376215b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Morph VDI_Healthy() into VRT_Healthy() and move the rest of the

VDI_ functions out of $ABI VRT.
parent 52b51aa1
......@@ -39,6 +39,8 @@
#include "cache_director.h"
#include "vrt.h"
/* Resolve director --------------------------------------------------*/
static const struct director *
......@@ -172,13 +174,16 @@ VDI_Http1Pipe(struct req *req, struct busyobj *bo)
*/
int
VDI_Healthy(const struct director *d, const struct busyobj *bo)
VRT_Healthy(VRT_CTX, VCL_BACKEND be)
{
CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
if (d->healthy == NULL)
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
if (be == NULL)
return (0);
CHECK_OBJ_NOTNULL(be, DIRECTOR_MAGIC);
if (be->healthy == NULL)
return (1);
return (d->healthy(d, bo, NULL));
return (be->healthy(be, ctx->bo, NULL));
}
/* Dump panic info -----------------------------------------------------
......
......@@ -37,18 +37,10 @@
*
*/
/*--------------------------------------------------------------------
* A director is a piece of code which selects one of possibly multiple
* backends to use.
*/
typedef unsigned vdi_healthy_f(const struct director *, const struct busyobj *,
double *changed);
typedef const struct director *vdi_resolve_f(const struct director *,
struct worker *, struct busyobj *);
typedef int vdi_gethdrs_f(const struct director *, struct worker *,
struct busyobj *);
typedef int vdi_getbody_f(const struct director *, struct worker *,
......@@ -79,16 +71,3 @@ struct director {
void *priv;
const void *priv2;
};
/* cache_director.c */
int VDI_GetHdr(struct worker *, struct busyobj *);
int VDI_GetBody(struct worker *, struct busyobj *);
const struct suckaddr *VDI_GetIP(struct worker *, struct busyobj *);
void VDI_Finish(struct worker *wrk, struct busyobj *bo);
enum sess_close VDI_Http1Pipe(struct req *, struct busyobj *);
int VDI_Healthy(const struct director *, const struct busyobj *);
void VDI_Panic(const struct director *, struct vsb *, const char *nm);
......@@ -49,6 +49,14 @@ void VBT_Init(void);
/* cache_backend_poll.c */
void VBP_Init(void);
/* cache_director.c */
int VDI_GetHdr(struct worker *, struct busyobj *);
int VDI_GetBody(struct worker *, struct busyobj *);
const struct suckaddr *VDI_GetIP(struct worker *, struct busyobj *);
void VDI_Finish(struct worker *wrk, struct busyobj *bo);
enum sess_close VDI_Http1Pipe(struct req *, struct busyobj *);
void VDI_Panic(const struct director *, struct vsb *, const char *nm);
/* cache_exp.c */
double EXP_Ttl(const struct req *, const struct objcore *);
void EXP_Insert(struct worker *wrk, struct objcore *oc);
......
......@@ -48,7 +48,9 @@
* binary/load-time compatible, increment MAJOR version
*
*
* 6.1 (unreleased):
* 6.2 (scheduled for: 2018-03-15)
* VRT_Healthy() added
* 6.1 (2017-09-15 aka 5.2)
* http_CollectHdrSep added
* VRT_purge modified (may fail a transaction, signature changed)
* 6.0 (2017-03-15):
......@@ -77,7 +79,7 @@
#define VRT_MAJOR_VERSION 6U
#define VRT_MINOR_VERSION 1U
#define VRT_MINOR_VERSION 2U
/***********************************************************************/
......@@ -355,6 +357,11 @@ void VRT_synth_page(VRT_CTX, const char *, ...);
/* Backend related */
struct director *VRT_new_backend(VRT_CTX, const struct vrt_backend *);
void VRT_delete_backend(VRT_CTX, struct director **);
int VRT_backend_healthy(VRT_CTX, struct director *);
/* cache_director.c */
int VRT_Healthy(VRT_CTX, VCL_BACKEND);
/* Suckaddr related */
int VRT_VSA_GetPtr(const struct suckaddr *sua, const unsigned char ** dst);
......
......@@ -198,10 +198,8 @@ VCL_BOOL __match_proto__(td_std_healthy)
vmod_healthy(VRT_CTX, VCL_BACKEND be)
{
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
if (be == NULL)
return (0);
CHECK_OBJ_NOTNULL(be, DIRECTOR_MAGIC);
return (VDI_Healthy(be, ctx->bo));
CHECK_OBJ_ORNULL(be, DIRECTOR_MAGIC);
return (VRT_Healthy(ctx, be));
}
VCL_INT __match_proto__(td_std_port)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment