You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by di...@apache.org on 2010/03/08 23:48:30 UTC
svn commit: r920554 - in /incubator/trafficserver/site/trunk/docs/v2/sdk:
NewProtocolPlugins.html ch07.html
Author: dianes
Date: Mon Mar 8 22:48:30 2010
New Revision: 920554
URL: http://svn.apache.org/viewvc?rev=920554&view=rev
Log:
ToC added
Modified:
incubator/trafficserver/site/trunk/docs/v2/sdk/NewProtocolPlugins.html
incubator/trafficserver/site/trunk/docs/v2/sdk/ch07.html
Modified: incubator/trafficserver/site/trunk/docs/v2/sdk/NewProtocolPlugins.html
URL: http://svn.apache.org/viewvc/incubator/trafficserver/site/trunk/docs/v2/sdk/NewProtocolPlugins.html?rev=920554&r1=920553&r2=920554&view=diff
==============================================================================
--- incubator/trafficserver/site/trunk/docs/v2/sdk/NewProtocolPlugins.html (original)
+++ incubator/trafficserver/site/trunk/docs/v2/sdk/NewProtocolPlugins.html Mon Mar 8 22:48:30 2010
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Chapter 6. New Protocol Plugins</title>
<!--#include file="top.html" -->
-<div class="navheader">
+</head><div class="navheader">
<div class="navprev">
<a accesskey="p" href="SampleBufferedNullTransformPlugin.html">Prev</a> â The Sample Buffered Null Transform Plugin</div>
<div class="navnext">Chapter 7. Cache Plugin â <a accesskey="n" href="ch07.html">Next</a>
@@ -13,54 +13,58 @@
<div class="chapter" lang="en">
<div class="titlepage"><div><div><h2 class="title">
<a name="NewProtocolPlugins"></a>Chapter 6. New Protocol Plugins</h2></div></div></div>
+
+<p><b>Table of Contents</b></p>
+<ul>
+<li><span class="section"><a href="NewProtocolPlugins.html#ProtocolPluginStructure">Protocol Plugin Structure</a></span></li>
+<li><span class="section"><a href="NewProtocolPlugins.html#ContinuationsInProtocolPlugin">Continuations in the Protocol Plugin</a></span></li>
+<li><span class="section"><a href="NewProtocolPlugins.html#EventFlow">Event Flow</a></span></li>
+<li><span class="section"><a href="NewProtocolPlugins.html#ImplementTransStMachine">One Way to Implement a Transaction State Machine</a></span></li>
+<li><span class="section"><a href="NewProtocolPlugins.html#ProcTypicalTransaction">Processing a Typical Transaction</a></span></li>
+</ul>
+
<p>The new protocol APIs enable you to extend Traffic Server to be a web
proxy for any protocol. This chapter describes new protocol APIs and
- the plugins that support new protocols. It also provides a detailed review of code for a <a href="AboutSampleProtocol.html"> sample Protocol plugin</a>
+ the plugins that support new protocols. It also provides a detailed review of code for a <a href="AboutSampleProtocol.html"> sample Protocol plugin</a>
that supports a very simple
artificial HTTP-like protocol.</p>
-<p>This chapter contains the following sections:</p>
-<div class="itemizedlist"><ul type="disc">
-<li>
-<p><a href="NewProtocolPlugins.html#AboutSampleProtocol" title="About the Sample Protocol">âAbout the Sample Protocolâ</a></p>
-<p>Gives the state diagram and header structure of the artificial
- protocol. Describes what the supporting plugin has to do.</p>
-</li>
-<li>
-<p><a href="NewProtocolPlugins.html#ProtocolPluginStructure" title="Protocol Plugin Structure">âProtocol Plugin Structureâ</a></p>
-<p>In-depth explanation of the Protocol plugin: begins with overall
- architecture, describes how to write continuations as state
- machines, and finishes with a walk-through of Protocol plugin code as it
- processes a transaction.</p>
-</li>
-</ul></div>
+
<div class="section" lang="en">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="AboutSampleProtocol"></a>About the Sample Protocol</h2></div></div></div>
<p>The sample protocol enables a client to ask a server for a file.
Clients send requests to a specific Traffic Server port (specified in
- <code>plugin.config</code>). The requests look like the following:</p>
-<p><span><strong class="command">server_name file_name\n\n</strong></span></p>
+ <code>plugin.config</code>); each request has the following structure:</p>
+<p><span><strong class="command"><code>server_name file_name\n\n</code></strong></span></p>
<p>Using the Protocol plugin, Traffic Server can accept these
- requests, parse them, and act as a proxy cache (i.e., requests the file from
- the origin server on the clientâs behalf and stores copies of
+ requests, parse them, and act as a proxy cache (i.e., request the file from
+ the origin server on the clientâs behalf and store copies of
response messages in cache). The Protocol plugin is a state machine
- that flows through the states illustrated in <a href="NewProtocolPlugins.html#Fig_SampleProtocolStDiag" title="Figure 6.1. Sample Protocol State Diagram">Figure 6.1, âSample Protocol State Diagramâ</a>. This figure illustrates the steps that
+ that flows through the states illustrated in the <a href="NewProtocolPlugins.html#Fig_SampleProtocolStDiag" title="Figure 6.1. Sample Protocol State Diagram">Sample Protocol State Diagram</a>. This figure illustrates the steps that
Traffic Server and the Protocol plugin go through in order to support the sample
protocol. </p>
<p>In more specific terms, Traffic Server and the Protocol plugin must:</p>
<div class="itemizedlist"><ul type="disc">
-<li><p>listen for and accept client connections (on the accept port
+<li>
+ <p>Listen for and accept client connections (on the accept port
specified in <code>plugin.config</code>)</p></li>
-<li><p>read incoming client requests</p></li>
-<li><p>look up the requested content in the Traffic Server
+<li>
+ <p>Read incoming client requests</p></li>
+<li>
+ <p>Look up the requested content in the Traffic Server
cache</p></li>
-<li><p>serve content from cache if the request is a cache hit
+<li>
+ <p>Serve content from cache if the request is a cache hit
(this simple example does <i>not</i> do freshness checking)</p></li>
-<li><p>open a connection to the origin server if the request is a
+<li>
+ <p>Open a connection to the origin server if the request is a
cache miss (on the server port specified in <code>plugin.config</code>)</p></li>
-<li><p>forward the request to the origin server</p></li>
-<li><p>receive the origin server response</p></li>
-<li><p>cache the response and send it on to the client</p></li>
+<li>
+ <p>Forward the request to the origin server</p></li>
+<li>
+ <p>Receive the origin server response</p></li>
+<li>
+ <p>Cache the response and send it on to the client</p></li>
</ul></div>
<div class="figure">
<a name="Fig_SampleProtocolStDiag"></a><p class="title"><b>Figure 6.1. Sample Protocol State Diagram</b></p>
@@ -71,7 +75,7 @@
<a name="ProtocolPluginStructure"></a>Protocol Plugin Structure</h3></div></div></div>
<p>To see how the Protocol plugin works, you need to understand some broader concepts. This section assumes you're familiar with the
concepts of <b>continuation</b>, Traffic Serverâs <b>asynchronous event model</b>,
- and basic Traffic Server <b>plugin structure</b>. If you are not familiar with these concepts, then reference <a href="GetingStarted.html#GettingStarted"><i>Getting Started</i></a> and <a href="CreatingTSPlugins.html" title="Chapter 2. How to Create Traffic Server Plugins"><i>How to Create Traffic Server Plugins</i></a>.</p>
+ and basic Traffic Server <b>plugin structure</b>. If you are not familiar with these concepts, then reference <a href="GetingStarted.html#GettingStarted">Getting Started</a> and <a href="CreatingTSPlugins.html" title="Chapter 2. How to Create Traffic Server Plugins">How to Create Traffic Server Plugins</a>.</p>
</div>
<div class="section" lang="en">
<div class="titlepage"><div><div><h3 class="title">
@@ -87,7 +91,7 @@
lives until the transaction completes; then it is destroyed. If
the clientâs request for content is a cache miss, then a transaction state
machine might need to open a connection to the origin server. This is
- illustrated in <a href="NewProtocolPlugins.html#Fig_ProtocolPluginOverview" title="Figure 6.2. Protocol Plugin Overview">Figure 6.2, âProtocol Plugin Overviewâ</a>.</p>
+ illustrated in the <a href="NewProtocolPlugins.html#Fig_ProtocolPluginOverview" title="Figure 6.2. Protocol Plugin Overview">Protocol Plugin Overview</a> diagram.</p>
<div class="figure">
<a name="Fig_ProtocolPluginOverview"></a><p class="title"><b>Figure 6.2. Protocol Plugin Overview</b></p>
<div class="mediaobject"><img src="images/protocol_sm_big.jpg" alt="Protocol Plugin Overview" /></div>
@@ -142,10 +146,10 @@
<a name="Fig_ProtocolPluginFlow"></a><p class="title"><b>Figure 6.3. Protocol Plugin Flow of Events</b></p>
<div class="mediaobject"><img src="images/protocol_evt.jpg" alt="Protocol Plugin Flow of Events" /></div>
</div>
-<p>The flow of events is illustrated in <a href="NewProtocolPlugins.html#Fig_ProtocolPluginFlow" title="Figure 6.3. Protocol Plugin Flow of Events">Figure 6.3, âProtocol Plugin Flow of Eventsâ</a>. The thin straight lines show Net
+<p>The flow of events is illustrated in the <a href="NewProtocolPlugins.html#Fig_ProtocolPluginFlow" title="Figure 6.3. Protocol Plugin Flow of Events">Protocol Plugin Flow of Events</a> diagram above. The thin straight lines show Net
Processor event flow, the thin dashed lines are Host DB event flow,
and the thick dashed lines are Cache event flow.</p>
-<p>Notice that this flow of events is independent of the Protocol plugin's design (i.e., whether you build âacceptâ and âtransactionâ
+<p>Notice that this flow of events is independent of the Protocol plugin's design (i.e., whether you build <b>accept</b> or <b>transaction</b>
state machines). Any plugin that supports network connections
uses the net vconnection interfaces (<code class="code">INKNetAccept</code>,
<code class="code">INKNetConnect</code>) and thus receives events from Net
@@ -159,7 +163,7 @@
<div class="section" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="ImplementTransStMachine"></a>One Way to Implement a Transaction State Machine</h3></div></div></div>
-<p>The transaction state machines (<b>TSM</b>s) in the Protocol plugin
+<p>The <b>transaction state machines</b> (<b>TSM</b>s) in the Protocol plugin
must do the following: </p>
<div class="itemizedlist"><ul type="disc">
<li><p>Keep track of the state of the transaction</p></li>
Modified: incubator/trafficserver/site/trunk/docs/v2/sdk/ch07.html
URL: http://svn.apache.org/viewvc/incubator/trafficserver/site/trunk/docs/v2/sdk/ch07.html?rev=920554&r1=920553&r2=920554&view=diff
==============================================================================
--- incubator/trafficserver/site/trunk/docs/v2/sdk/ch07.html (original)
+++ incubator/trafficserver/site/trunk/docs/v2/sdk/ch07.html Mon Mar 8 22:48:30 2010
@@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Chapter 7. Cache Plugin</title>
<!--#include file="top.html" -->
-<div class="navheader">
+</head><div class="navheader">
<div class="navprev">
<a accesskey="p" href="NewProtocolPlugins.html">Prev</a> â Chapter 6. New Protocol Plugins</div>
<div class="navnext">Reads and Writes â <a accesskey="n" href="ch07s02.html">Next</a>
@@ -23,6 +23,7 @@
<li><span class="section"><a href="ch07s05.html">Cache Events</a></span></li>
</ul>
+
<p>The Traffic Server cache plugin replaces the cache engine and the
underlying storage of Traffic Server's built-in cache. Writing your own
plugin enables you to control the storage mechanisms (ie, memory, disk,