Commit e88f87b4 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Polishing

parent 9ba9a8bb
......@@ -695,7 +695,7 @@ void VCA_FailSess(struct worker *w);
void VBE_UseHealth(const struct director *vdi);
void VBE_DiscardHealth(const struct director *vdi);
/* cache_dir.c */
int VDI_GetHdr(struct worker *wrk, struct busyobj *bo);
struct vbc *VDI_GetFd(const struct director *d, struct worker *wrk,
struct busyobj *);
......
......@@ -26,43 +26,21 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This is the central switch-board for backend connections and it is
* slightly complicated by a number of optimizations.
* Backend and Director APIs
*
* The data structures:
* A director ("VDI") is an abstract entity which can either satisfy a
* backend fetch request or select another director for the job.
*
* A vrt_backend is a definition of a backend in a VCL program.
* In theory a director does not have to talk HTTP over TCP, it can satisfy
* the backend request using any means it wants, although this is presently
* not implemented.
*
* A backend is a TCP destination, possibly multi-homed and it has a
* number of associated properties and statistics.
* A backend ("VBE") is a director which talks HTTP over TCP.
*
* A vbc is an open TCP connection to a backend.
*
* A bereq is a memory carrier for handling a HTTP transaction with
* a backend over a vbc.
*
* A director is a piece of code that selects which backend to use,
* by whatever method or metric it chooses.
*
* The relationships:
*
* Backends and directors get instantiated when VCL's are loaded,
* and this always happen in the CLI thread.
*
* When a VCL tries to instantiate a backend, any existing backend
* with the same identity (== definition in VCL) will be used instead
* so that vbc's can be reused across VCL changes.
*
* Directors disapper with the VCL that created them.
*
* Backends disappear when their reference count drop to zero.
*
* Backends have their host/port name looked up to addrinfo structures
* when they are instantiated, and we just cache that result and cycle
* through the entries (for multihomed backends) on failure only.
* XXX: add cli command to redo lookup.
*
* bereq is sort of a step-child here, we just manage the pool of them.
* As you'll notice the terminology is a bit muddled here, but we try to
* keep it clean on the user-facing side, where a "director" is always
* a "pick a backend/director" functionality, and a "backend" is whatever
* satisfies the actual request in the end.
*
*/
......
......@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Handle backend connections and backend request structures.
* Abstract backend API
*
*/
......@@ -161,5 +161,6 @@ VDI_Healthy(const struct director *d)
{
CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
AN(d->healthy);
return (d->healthy(d, NULL));
}
......@@ -133,7 +133,8 @@ vbf_beresp2obj(struct busyobj *bo)
return (-1);
if (vary != NULL) {
b = ObjSetattr(bo->wrk, bo->fetch_objcore, OA_VARY, varyl, VSB_data(vary));
b = ObjSetattr(bo->wrk, bo->fetch_objcore, OA_VARY, varyl,
VSB_data(vary));
VSB_delete(vary);
}
......@@ -149,7 +150,8 @@ vbf_beresp2obj(struct busyobj *bo)
bo->uncacheable ? HTTPH_R_PASS : HTTPH_A_INS);
if (http_GetHdr(bo->beresp, H_Last_Modified, &b))
AZ(ObjSetDouble(bo->wrk, bo->fetch_objcore, OA_LASTMODIFIED, VTIM_parse(b)));
AZ(ObjSetDouble(bo->wrk, bo->fetch_objcore, OA_LASTMODIFIED,
VTIM_parse(b)));
else
AZ(ObjSetDouble(bo->wrk, bo->fetch_objcore, OA_LASTMODIFIED,
floor(bo->fetch_objcore->exp.t_origin)));
......
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