Author: mahadev Date: Fri Feb 19 06:25:46 2010 New Revision: 911712 URL: http://svn.apache.org/viewvc?rev=911712&view=rev Log: ZOOKEEPER-665. Add BookKeeper streaming documentation (flavio via mahadev)
Added: hadoop/zookeeper/trunk/docs/bookkeeperStream.html hadoop/zookeeper/trunk/docs/bookkeeperStream.pdf hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/bookkeeperStream.xml Modified: hadoop/zookeeper/trunk/CHANGES.txt hadoop/zookeeper/trunk/docs/index.html hadoop/zookeeper/trunk/docs/index.pdf hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/index.xml Modified: hadoop/zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=911712&r1=911711&r2=911712&view=diff ============================================================================== --- hadoop/zookeeper/trunk/CHANGES.txt (original) +++ hadoop/zookeeper/trunk/CHANGES.txt Fri Feb 19 06:25:46 2010 @@ -279,6 +279,8 @@ ZOOKEEPER-507. BookKeeper client re-write (Utkarsh and ben via mahadev) + ZOOKEEPER-665. Add BookKeeper streaming documentation (flavio via mahadev) + NEW FEATURES: ZOOKEEPER-539. generate eclipse project via ant target. (phunt via mahadev) Added: hadoop/zookeeper/trunk/docs/bookkeeperStream.html URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/bookkeeperStream.html?rev=911712&view=auto ============================================================================== --- hadoop/zookeeper/trunk/docs/bookkeeperStream.html (added) +++ hadoop/zookeeper/trunk/docs/bookkeeperStream.html Fri Feb 19 06:25:46 2010 @@ -0,0 +1,610 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<meta content="Apache Forrest" name="Generator"> +<meta name="Forrest-version" content="0.8"> +<meta name="Forrest-skin-name" content="pelt"> +<title>Streaming with BookKeeper</title> +<link type="text/css" href="skin/basic.css" rel="stylesheet"> +<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet"> +<link media="print" type="text/css" href="skin/print.css" rel="stylesheet"> +<link type="text/css" href="skin/profile.css" rel="stylesheet"> +<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script> +<link rel="shortcut icon" href="images/favicon.ico"> +</head> +<body onload="init()"> +<script type="text/javascript">ndeSetTextSize();</script> +<div id="top"> +<!--+ + |breadtrail + +--> +<div class="breadtrail"> +<a href="http://www.apache.org/">Apache</a> > <a href="http://hadoop.apache.org/">Hadoop</a> > <a href="http://hadoop.apache.org/zookeeper/">ZooKeeper</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script> +</div> +<!--+ + |header + +--> +<div class="header"> +<!--+ + |start group logo + +--> +<div class="grouplogo"> +<a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a> +</div> +<!--+ + |end group logo + +--> +<!--+ + |start Project Logo + +--> +<div class="projectlogo"> +<a href="http://hadoop.apache.org/zookeeper/"><img class="logoImage" alt="ZooKeeper" src="images/zookeeper_small.gif" title="ZooKeeper: distributed coordination"></a> +</div> +<!--+ + |end Project Logo + +--> +<!--+ + |start Search + +--> +<div class="searchbox"> +<form action="http://www.google.com/search" method="get" class="roundtopsmall"> +<input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google"> + <input name="Search" value="Search" type="submit"> +</form> +</div> +<!--+ + |end search + +--> +<!--+ + |start Tabs + +--> +<ul id="tabs"> +<li> +<a class="unselected" href="http://hadoop.apache.org/zookeeper/">Project</a> +</li> +<li> +<a class="unselected" href="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a> +</li> +<li class="current"> +<a class="selected" href="index.html">ZooKeeper 3.3 Documentation</a> +</li> +</ul> +<!--+ + |end Tabs + +--> +</div> +</div> +<div id="main"> +<div id="publishedStrip"> +<!--+ + |start Subtabs + +--> +<div id="level2tabs"></div> +<!--+ + |end Endtabs + +--> +<script type="text/javascript"><!-- +document.write("Last Published: " + document.lastModified); +// --></script> +</div> +<!--+ + |breadtrail + +--> +<div class="breadtrail"> + + + </div> +<!--+ + |start Menu, mainarea + +--> +<!--+ + |start Menu + +--> +<div id="menu"> +<div onclick="SwitchMenu('menu_1.1', 'skin/')" id="menu_1.1Title" class="menutitle">Overview</div> +<div id="menu_1.1" class="menuitemgroup"> +<div class="menuitem"> +<a href="index.html">Welcome</a> +</div> +<div class="menuitem"> +<a href="zookeeperOver.html">Overview</a> +</div> +<div class="menuitem"> +<a href="zookeeperStarted.html">Getting Started</a> +</div> +<div class="menuitem"> +<a href="releasenotes.html">Release Notes</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.2', 'skin/')" id="menu_1.2Title" class="menutitle">Developer</div> +<div id="menu_1.2" class="menuitemgroup"> +<div class="menuitem"> +<a href="api/index.html">API Docs</a> +</div> +<div class="menuitem"> +<a href="zookeeperProgrammers.html">Programmer's Guide</a> +</div> +<div class="menuitem"> +<a href="javaExample.html">Java Example</a> +</div> +<div class="menuitem"> +<a href="zookeeperTutorial.html">Barrier and Queue Tutorial</a> +</div> +<div class="menuitem"> +<a href="recipes.html">Recipes</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.3', 'skin/')" id="menu_1.3Title" class="menutitle">BookKeeper</div> +<div id="menu_1.3" class="menuitemgroup"> +<div class="menuitem"> +<a href="bookkeeperStarted.html">Getting started</a> +</div> +<div class="menuitem"> +<a href="bookkeeperOverview.html">Overview</a> +</div> +<div class="menuitem"> +<a href="bookkeeperConfig.html">Setup guide</a> +</div> +<div class="menuitem"> +<a href="bookkeeperProgrammer.html">Programmer's guide</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.4', 'skin/')" id="menu_1.4Title" class="menutitle">Admin & Ops</div> +<div id="menu_1.4" class="menuitemgroup"> +<div class="menuitem"> +<a href="zookeeperAdmin.html">Administrator's Guide</a> +</div> +<div class="menuitem"> +<a href="zookeeperQuotas.html">Quota Guide</a> +</div> +<div class="menuitem"> +<a href="zookeeperJMX.html">JMX</a> +</div> +<div class="menuitem"> +<a href="zookeeperObservers.html">Observers Guide</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.5', 'skin/')" id="menu_1.5Title" class="menutitle">Contributor</div> +<div id="menu_1.5" class="menuitemgroup"> +<div class="menuitem"> +<a href="zookeeperInternals.html">ZooKeeper Internals</a> +</div> +</div> +<div onclick="SwitchMenu('menu_1.6', 'skin/')" id="menu_1.6Title" class="menutitle">Miscellaneous</div> +<div id="menu_1.6" class="menuitemgroup"> +<div class="menuitem"> +<a href="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a> +</div> +<div class="menuitem"> +<a href="http://wiki.apache.org/hadoop/ZooKeeper/FAQ">FAQ</a> +</div> +<div class="menuitem"> +<a href="http://hadoop.apache.org/zookeeper/mailing_lists.html">Mailing Lists</a> +</div> +</div> +<div id="credit"></div> +<div id="roundbottom"> +<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div> +<!--+ + |alternative credits + +--> +<div id="credit2"></div> +</div> +<!--+ + |end Menu + +--> +<!--+ + |start content + +--> +<div id="content"> +<div title="Portable Document Format" class="pdflink"> +<a class="dida" href="bookkeeperStream.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br> + PDF</a> +</div> +<h1>Streaming with BookKeeper</h1> +<div id="minitoc-area"> +<ul class="minitoc"> +<li> +<a href="#bk_StreamSummary">Summary</a> +</li> +<li> +<a href="#bk_LedgerOutputStream">Writing a stream of bytes</a> +</li> +<li> +<a href="#bk_LedgerInputStream">Reading a stream of bytes</a> +</li> +</ul> +</div> + + + + +<a name="N10009"></a><a name="bk_StreamSummary"></a> +<h2 class="h3">Summary</h2> +<div class="section"> +<p> + When using the BookKeeper API, an application has to split the data to write into entries, each + entry being a byte array. This is natural for many applications. For example, when using BookKeeper + for write-ahead logging, an application typically wants to write the modifications corresponding + to a command or a transaction. Some other applications, however, might not have a natural boundary + for entries, and may prefer to write and read streams of bytes. This is exactly the purpose of the + stream API we have implemented on top of BookKeeper. + </p> +<p> + The stream API is implemented in the package <span class="codefrag computeroutput">Streaming</span>, and it contains two main classes: <span class="codefrag computeroutput">LedgerOutputStream</span> and + <span class="codefrag computeroutput">LedgerInputStream</span>. The class names are indicative of what they do. + </p> +</div> + + +<a name="N10022"></a><a name="bk_LedgerOutputStream"></a> +<h2 class="h3">Writing a stream of bytes</h2> +<div class="section"> +<p> + Class <span class="codefrag computeroutput">LedgerOutputStream</span> implements two constructors and five public methods: + </p> +<p> + +<span class="codefrag computeroutput"> + public LedgerOutputStream(LedgerHandle lh) + </span> + +</p> +<p> + where: + </p> +<ul> + +<li> + +<p> + +<span class="codefrag computeroutput">lh</span> is a ledger handle for a previously created and open ledger. + </p> + +</li> + +</ul> +<p> + +<span class="codefrag computeroutput"> + public LedgerOutputStream(LedgerHandle lh, int size) + </span> + +</p> +<p> + where: + </p> +<ul> + +<li> + +<p> + +<span class="codefrag computeroutput">lh</span> is a ledger handle for a previously created and open ledger. + </p> + +</li> + + +<li> + +<p> + +<span class="codefrag computeroutput">size</span> is the size of the byte buffer to store written bytes before flushing. + </p> + +</li> + +</ul> +<p> + +<strong>Closing a stream.</strong> This call closes the stream by flushing the write buffer. + </p> +<p> + +<span class="codefrag computeroutput"> + public void close() + </span> + +</p> +<p> + which has no parameters. + </p> +<p> + +<strong>Flushing a stream.</strong> This call essentially flushes the write buffer. + </p> +<p> + +<span class="codefrag computeroutput"> + public synchronized void flush() + </span> + +</p> +<p> + which has no parameters. + </p> +<p> + +<strong>Writing bytes.</strong> There are three calls for writing bytes to a stream. + </p> +<p> + +<span class="codefrag computeroutput"> + public synchronized void write(byte[] b) + </span> + +</p> +<p> + where: + </p> +<ul> + +<li> + +<p> + +<span class="codefrag computeroutput">b</span> is an array of bytes to write. + </p> + +</li> + +</ul> +<p> + +<span class="codefrag computeroutput"> + public synchronized void write(byte[] b, int off, int len) + </span> + +</p> +<p> + where: + </p> +<ul> + +<li> + +<p> + +<span class="codefrag computeroutput">b</span> is an array of bytes to write. + </p> + +</li> + + +<li> + +<p> + +<span class="codefrag computeroutput">off</span> is a buffer offset. + </p> + +</li> + + +<li> + +<p> + +<span class="codefrag computeroutput">len</span> is the length to write. + </p> + +</li> + +</ul> +<p> + +<span class="codefrag computeroutput"> + public synchronized void write(int b) + </span> + +</p> +<p> + where: + </p> +<ul> + +<li> + +<p> + +<span class="codefrag computeroutput">b</span> contains a byte to write. The method writes the least significant byte of the integer four bytes. + </p> + +</li> + +</ul> +</div> + + +<a name="N100E7"></a><a name="bk_LedgerInputStream"></a> +<h2 class="h3">Reading a stream of bytes</h2> +<div class="section"> +<p> + Class <span class="codefrag computeroutput">LedgerOutputStream</span> implements two constructors and four public methods: + </p> +<p> + +<span class="codefrag computeroutput"> + public LedgerInputStream(LedgerHandle lh) + throws BKException, InterruptedException + </span> + +</p> +<p> + where: + </p> +<ul> + +<li> + +<p> + +<span class="codefrag computeroutput">lh</span> is a ledger handle for a previously created and open ledger. + </p> + +</li> + +</ul> +<p> + +<span class="codefrag computeroutput"> + public LedgerInputStream(LedgerHandle lh, int size) + throws BKException, InterruptedException + </span> + +</p> +<p> + where: + </p> +<ul> + +<li> + +<p> + +<span class="codefrag computeroutput">lh</span> is a ledger handle for a previously created and open ledger. + </p> + +</li> + + +<li> + +<p> + +<span class="codefrag computeroutput">size</span> is the size of the byte buffer to store bytes that the application + will eventually read. + </p> + +</li> + +</ul> +<p> + +<strong>Closing.</strong> There is one call to close an input stream, but the call + is currently empty and the application is responsible for closing the ledger handle. + </p> +<p> + +<span class="codefrag computeroutput"> + public void close() + </span> + +</p> +<p> + which has no parameters. + </p> +<p> + +<strong>Reading.</strong> There are three calls to read from the stream. + </p> +<p> + +<span class="codefrag computeroutput"> + public synchronized int read() + throws IOException + </span> + +</p> +<p> + which has no parameters. + </p> +<p> + +<span class="codefrag computeroutput"> + public synchronized int read(byte[] b) + throws IOException + </span> + +</p> +<p> + where: + </p> +<ul> + +<li> + +<p> + +<span class="codefrag computeroutput">b</span> is a byte array to write to. + </p> + +</li> + +</ul> +<p> + +<span class="codefrag computeroutput"> + public synchronized int read(byte[] b, int off, int len) + throws IOException + </span> + +</p> +<p> + where: + </p> +<ul> + +<li> + +<p> + +<span class="codefrag computeroutput">b</span> is a byte array to write to. + </p> + +</li> + + +<li> + +<p> + +<span class="codefrag computeroutput">off</span> is an offset for byte array <span class="codefrag computeroutput">b</span>. + </p> + +</li> + + +<li> + +<p> + +<span class="codefrag computeroutput">len</span> is the length in bytes to write to <span class="codefrag computeroutput">b</span>. + </p> + +</li> + +</ul> +</div> + +<p align="right"> +<font size="-2"></font> +</p> +</div> +<!--+ + |end content + +--> +<div class="clearboth"> </div> +</div> +<div id="footer"> +<!--+ + |start bottomstrip + +--> +<div class="lastmodified"> +<script type="text/javascript"><!-- +document.write("Last Published: " + document.lastModified); +// --></script> +</div> +<div class="copyright"> + Copyright © + 2008 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a> +</div> +<!--+ + |end bottomstrip + +--> +</div> +</body> +</html> Added: hadoop/zookeeper/trunk/docs/bookkeeperStream.pdf URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/bookkeeperStream.pdf?rev=911712&view=auto ============================================================================== --- hadoop/zookeeper/trunk/docs/bookkeeperStream.pdf (added) +++ hadoop/zookeeper/trunk/docs/bookkeeperStream.pdf Fri Feb 19 06:25:46 2010 @@ -0,0 +1,249 @@ +%PDF-1.3 +%ª«¬ +4 0 obj +<< /Type /Info +/Producer (FOP 0.20.5) >> +endobj +5 0 obj +<< /Length 480 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gb!#Xb>Q22']&L6m]nC&H1nKW7i&[63o`P4'M+oBD(lDSr4Pf3Uii'@Q's=oPFUEtF-><u(0jWP:l[5?7=acD*ai(S"E=5M8F9Nt0k*u]=TpJ;e7b7OA\B)"'oee#3o$!...@20pbn-+;NK`FZ?qo^m4o*eMMRs^*Q$+q-[#oOT;-IY0HhH"b...@bu)EsauDWl"mnw...@bpf4ajqrk%vd]pclilfg,^h`P7X+/'o]`faEo$0:V*ogc>2b,\LtMtU]rW,.7#j%dA^u5*ZS'M]j?'Pdheh/^3.E3[]ogS.H"ARAeMp3rT6S3dNma[nG0uKSrCQ.0s6kfP`4k6>EB$P&bCU9!gt`&W3(C.Qme2DJ'qcie_.,1-AV-Md_^M3u/)OD7+p:l...@^a[mvkf6s%ug@/)q#T.i#uIMK.WQ[ZV]eD";in:K:hH\aGGNe@&]EVGoG</R,DAE4MGZQAsCdEe1mq0Bni6`W~> +endstream +endobj +6 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 612 792 ] +/Resources 3 0 R +/Contents 5 0 R +/Annots 7 0 R +>> +endobj +7 0 obj +[ +8 0 R +10 0 R +12 0 R +] +endobj +8 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 102.0 529.541 156.668 517.541 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 9 0 R +/H /I +>> +endobj +10 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 102.0 511.341 231.98 499.341 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 11 0 R +/H /I +>> +endobj +12 0 obj +<< /Type /Annot +/Subtype /Link +/Rect [ 102.0 493.141 234.644 481.141 ] +/C [ 0 0 0 ] +/Border [ 0 0 0 ] +/A 13 0 R +/H /I +>> +endobj +14 0 obj +<< /Length 1703 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gb!#\95iiK&AJ$CkdUX+Y"66QgFSe:gB-1T#56F95g-M\X<agA'\E6J4*oO!g6,q^/PtMiOPt.j^2I?-j)X\h.<;@_>\CTM\B]7`*>a1'PIRh5qAu>:kU]Bip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NHs#IbK+>HEVi$OO&::-%o9/(VtM/<P-P<E^S=1pVWfl+)p]:#3Y23^%AZl;^YN6p2Wbd24tS_k-`cChFESS8_R#UT;e6L)bMLg7e)Si'*VlmqHX[sL^*Xpp$M/>=NJDm_h(DFX8/NZVYXZW;2(BXUsSb'\&,^#:X5hG/I\\N',#r,B,//q...@q&ROab4)PQfXm(%tpiMSJ2DPSrRqmgk4-2Ib'S5kd-O5lh#=]58;1Gk+c$D'#JpJmY2=[<+lkP4>%\qVjVL*h$B"2:^pqU+!_GBb=W;Zu6.0\9IZ/a...@o1@,qKPn5j'aGI56-KirR(T.X\`LIck$Qe?AJ0Zai,3fbbK:G*&*`rR37NhjIng:\$n5gYel?8dE#;kCN&-_*YlOjtT1[aBZj3gk!!jKIu4U9"+3#W8%gckt)8qoi%mj...@m\b?q?fi'Y"6FFM1+lMNl=rJHZf,=&Tu>&>#IW1MRdV@<oa'g=F>X#.:,6^9sYe,*-RqM:E[\22l##eNl.UCXjL<cTjG^,)!q5+^Vqs*~> +endstream +endobj +15 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 612 792 ] +/Resources 3 0 R +/Contents 14 0 R +>> +endobj +16 0 obj +<< /Length 1367 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gb!#\=d,=E&:W67i)*^dShS'$q(8)A'?@)p...@d,fm5\Q7X+GL<B.e9c=EsR)RO;8p<WNB1J5YkbEfA4m(c...@podph)mp*W5rM#]4$TT'*p;GO+QrN,uif-*5an...@jn\a,.U(!WpP(h_*g$hM6<mtWuZamJ)=<Eku[E6kl_0Y4ros84Tb2^0uH2:Z[LV(kf7FG&0>-+'[P856)%C\:^LBm./[JCW^]=iL=ZpP-aRm-7o'!HWs3h\k\iWl$sRPD9Q#VQmj*Ae\)Yd9J:%...@8ip#w#g`98j?\8r4eg\ll:A%AHONlT,JG9?Z;*8JJ_oE"eoapr*.qolqizdp*e89tlafre4hudig`...@j]"%$X#Z.ADN?:EoImom]0#T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3 0 R +/Contents 16 0 R +>> +endobj +18 0 obj +<< /Length 852 /Filter [ /ASCII85Decode /FlateDecode ] + >> +stream +Gau0B9on!^&a...@7.pp`kschmmfdl)0ig)g*q\Li.6i/jlK;^YdAIsmjjYQIU%Zr@<qEG!4/jur&Ka2)U4r!Y8]f^FS<64a1C\c&A+IXY"9#WXRG9S79"3"Fg#0n>+/';kkGU6,=]cpfbl3MIX&JVT^hQHuk!c-R`Iacb'iKm(f.`$?j5.9"(qGQdOa]8&B4dENbB8GDqpX(7e<$Q$`VJoE+](ShudB?DX3IGu2GAs?rRP3(+Z?$WB.h;)55d47G>Q_UX`lcPo[H:l'\P!-bVdr_#(C^uKZ*8=qg)-u<QeD.1g7HKIHcfA[nE\"R6]d]NNn]U=gR9E\&/d>M1J713bkScSW'[+":o#8RC\!;8aFK<l+<DU0/@]Pg(LCi5S66qNN/n...@9s)s...@8kzafc-,c=!J`Y+H;HgWVM\Au0&^9129rO6r/-mk...@`,\Y+X&R_HuoFlSS!U[8]RhEs&lrontmp!w1b...@6/O%Od3qfN$k55QAps2]XrI3H-th)#P2>V2FtB=,?.\cJ?/$hnHNQ)ac...@m:h[>W%%b]7<6TilMTK)L,h`&cP\?'V9]Dn:a...@l$!iioegec(VW4XoK0=lSt\`6GL1=T,L+Q9U6BX"6d...@?[?lxtwuevm"s\eP^`gWACAmUjbLK>g2+f$",WN'=o=!;h_H?+GT9WS1Zch574n\Tun:ZpSK'am+HO[<-hF[J5%R*A!/:p]Q^_S'3%`m74TfQCUY7ce;o+I9U;!(JHR+\2n"-VB,E1?.+?>iQPa;Ub1=qt("$...@i,b5[Z7(:1JFY`RUH_"3,h1X7[h!(_GT%!ugoYQneB/Ft%SukUrI]5>L^&&2LN`#i~> +endstream +endobj +19 0 obj +<< /Type /Page +/Parent 1 0 R +/MediaBox [ 0 0 612 792 ] +/Resources 3 0 R +/Contents 18 0 R +>> +endobj +21 0 obj +<< + /Title (\376\377\0\61\0\40\0\123\0\165\0\155\0\155\0\141\0\162\0\171) + /Parent 20 0 R + /Next 22 0 R + /A 9 0 R +>> endobj +22 0 obj +<< + /Title (\376\377\0\62\0\40\0\127\0\162\0\151\0\164\0\151\0\156\0\147\0\40\0\141\0\40\0\163\0\164\0\162\0\145\0\141\0\155\0\40\0\157\0\146\0\40\0\142\0\171\0\164\0\145\0\163) + /Parent 20 0 R + /Prev 21 0 R + /Next 23 0 R + /A 11 0 R +>> endobj +23 0 obj +<< + /Title (\376\377\0\63\0\40\0\122\0\145\0\141\0\144\0\151\0\156\0\147\0\40\0\141\0\40\0\163\0\164\0\162\0\145\0\141\0\155\0\40\0\157\0\146\0\40\0\142\0\171\0\164\0\145\0\163) + /Parent 20 0 R + /Prev 22 0 R + /A 13 0 R +>> endobj +24 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F3 +/BaseFont /Helvetica-Bold +/Encoding /WinAnsiEncoding >> +endobj +25 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F5 +/BaseFont /Times-Roman +/Encoding /WinAnsiEncoding >> +endobj +26 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F1 +/BaseFont /Helvetica +/Encoding /WinAnsiEncoding >> +endobj +27 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F9 +/BaseFont /Courier +/Encoding /WinAnsiEncoding >> +endobj +28 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F2 +/BaseFont /Helvetica-Oblique +/Encoding /WinAnsiEncoding >> +endobj +29 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F7 +/BaseFont /Times-Bold +/Encoding /WinAnsiEncoding >> +endobj +1 0 obj +<< /Type /Pages +/Count 4 +/Kids [6 0 R 15 0 R 17 0 R 19 0 R ] >> +endobj +2 0 obj +<< /Type /Catalog +/Pages 1 0 R + /Outlines 20 0 R + /PageMode /UseOutlines + >> +endobj +3 0 obj +<< +/Font << /F3 24 0 R /F5 25 0 R /F1 26 0 R /F9 27 0 R /F2 28 0 R /F7 29 0 R >> +/ProcSet [ /PDF /ImageC /Text ] >> +endobj +9 0 obj +<< +/S /GoTo +/D [15 0 R /XYZ 85.0 659.0 null] +>> +endobj +11 0 obj +<< +/S /GoTo +/D [15 0 R /XYZ 85.0 479.866 null] +>> +endobj +13 0 obj +<< +/S /GoTo +/D [17 0 R /XYZ 85.0 414.6 null] +>> +endobj +20 0 obj +<< + /First 21 0 R + /Last 23 0 R +>> endobj +xref +0 30 +0000000000 65535 f +0000007018 00000 n +0000007097 00000 n +0000007189 00000 n +0000000015 00000 n +0000000071 00000 n +0000000642 00000 n +0000000762 00000 n +0000000801 00000 n +0000007323 00000 n +0000000936 00000 n +0000007386 00000 n +0000001072 00000 n +0000007452 00000 n +0000001209 00000 n +0000003005 00000 n +0000003113 00000 n +0000004573 00000 n +0000004681 00000 n +0000005625 00000 n +0000007516 00000 n +0000005733 00000 n +0000005866 00000 n +0000006118 00000 n +0000006356 00000 n +0000006469 00000 n +0000006579 00000 n +0000006687 00000 n +0000006793 00000 n +0000006909 00000 n +trailer +<< +/Size 30 +/Root 2 0 R +/Info 4 0 R +>> +startxref +7567 +%%EOF Modified: hadoop/zookeeper/trunk/docs/index.html URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/index.html?rev=911712&r1=911711&r2=911712&view=diff ============================================================================== --- hadoop/zookeeper/trunk/docs/index.html (original) +++ hadoop/zookeeper/trunk/docs/index.html Fri Feb 19 06:25:46 2010 @@ -352,6 +352,10 @@ <a href="bookkeeperProgrammer.html">Awesome, but how do I integrate it with my app?</a> </li> +<li> +<a href="bookkeeperStream.html">Can I stream bytes instead of entries?</a> +</li> + </ul> </li> Modified: hadoop/zookeeper/trunk/docs/index.pdf URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/docs/index.pdf?rev=911712&r1=911711&r2=911712&view=diff ============================================================================== Binary files - no diff available. Added: hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/bookkeeperStream.xml URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/bookkeeperStream.xml?rev=911712&view=auto ============================================================================== --- hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/bookkeeperStream.xml (added) +++ hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/bookkeeperStream.xml Fri Feb 19 06:25:46 2010 @@ -0,0 +1,331 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2002-2004 The Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN" +"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd"> +<article id="bk_Stream"> + <title>Streaming with BookKeeper</title> + + <articleinfo> + <legalnotice> + <para>Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. You may + obtain a copy of the License at <ulink + url="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</ulink>.</para> + + <para>Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied. See the License for the specific language governing permissions + and limitations under the License.</para> + </legalnotice> + + <abstract> + <para>This guide contains detailed information about using how to stream bytes + on top of BookKeeper. It essentially motivates and discusses the basic stream + operations currently supported.</para> + </abstract> + </articleinfo> + <section id="bk_StreamSummary"> + <title>Summary</title> + + <para> + When using the BookKeeper API, an application has to split the data to write into entries, each + entry being a byte array. This is natural for many applications. For example, when using BookKeeper + for write-ahead logging, an application typically wants to write the modifications corresponding + to a command or a transaction. Some other applications, however, might not have a natural boundary + for entries, and may prefer to write and read streams of bytes. This is exactly the purpose of the + stream API we have implemented on top of BookKeeper. + </para> + + <para> + The stream API is implemented in the package <computeroutput>Streaming</computeroutput>, and it contains two main classes: <computeroutput>LedgerOutputStream</computeroutput> and + <computeroutput>LedgerInputStream</computeroutput>. The class names are indicative of what they do. + </para> + </section> + + <section id="bk_LedgerOutputStream"> + <title>Writing a stream of bytes</title> + <para> + Class <computeroutput>LedgerOutputStream</computeroutput> implements two constructors and five public methods: + </para> + + <para> + <computeroutput> + public LedgerOutputStream(LedgerHandle lh) + </computeroutput> + </para> + + <para> + where: + </para> + <itemizedlist> + <listitem> + <para> + <computeroutput>lh</computeroutput> is a ledger handle for a previously created and open ledger. + </para> + </listitem> + </itemizedlist> + + <para> + <computeroutput> + public LedgerOutputStream(LedgerHandle lh, int size) + </computeroutput> + </para> + + <para> + where: + </para> + <itemizedlist> + <listitem> + <para> + <computeroutput>lh</computeroutput> is a ledger handle for a previously created and open ledger. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>size</computeroutput> is the size of the byte buffer to store written bytes before flushing. + </para> + </listitem> + </itemizedlist> + + + <para> + <emphasis role="bold">Closing a stream.</emphasis> This call closes the stream by flushing the write buffer. + </para> + <para> + <computeroutput> + public void close() + </computeroutput> + </para> + + <para> + which has no parameters. + </para> + + <para> + <emphasis role="bold">Flushing a stream.</emphasis> This call essentially flushes the write buffer. + </para> + <para> + <computeroutput> + public synchronized void flush() + </computeroutput> + </para> + + <para> + which has no parameters. + </para> + + <para> + <emphasis role="bold">Writing bytes.</emphasis> There are three calls for writing bytes to a stream. + </para> + + <para> + <computeroutput> + public synchronized void write(byte[] b) + </computeroutput> + </para> + + <para> + where: + </para> + <itemizedlist> + <listitem> + <para> + <computeroutput>b</computeroutput> is an array of bytes to write. + </para> + </listitem> + </itemizedlist> + + <para> + <computeroutput> + public synchronized void write(byte[] b, int off, int len) + </computeroutput> + </para> + + <para> + where: + </para> + <itemizedlist> + <listitem> + <para> + <computeroutput>b</computeroutput> is an array of bytes to write. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>off</computeroutput> is a buffer offset. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>len</computeroutput> is the length to write. + </para> + </listitem> + </itemizedlist> + + <para> + <computeroutput> + public synchronized void write(int b) + </computeroutput> + </para> + + <para> + where: + </para> + <itemizedlist> + <listitem> + <para> + <computeroutput>b</computeroutput> contains a byte to write. The method writes the least significant byte of the integer four bytes. + </para> + </listitem> + </itemizedlist> + </section> + + <section id="bk_LedgerInputStream"> + <title>Reading a stream of bytes</title> + + <para> + Class <computeroutput>LedgerOutputStream</computeroutput> implements two constructors and four public methods: + </para> + + <para> + <computeroutput> + public LedgerInputStream(LedgerHandle lh) + throws BKException, InterruptedException + </computeroutput> + </para> + + <para> + where: + </para> + <itemizedlist> + <listitem> + <para> + <computeroutput>lh</computeroutput> is a ledger handle for a previously created and open ledger. + </para> + </listitem> + </itemizedlist> + + <para> + <computeroutput> + public LedgerInputStream(LedgerHandle lh, int size) + throws BKException, InterruptedException + </computeroutput> + </para> + + <para> + where: + </para> + <itemizedlist> + <listitem> + <para> + <computeroutput>lh</computeroutput> is a ledger handle for a previously created and open ledger. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>size</computeroutput> is the size of the byte buffer to store bytes that the application + will eventually read. + </para> + </listitem> + </itemizedlist> + + <para> + <emphasis role="bold">Closing.</emphasis> There is one call to close an input stream, but the call + is currently empty and the application is responsible for closing the ledger handle. + </para> + <para> + <computeroutput> + public void close() + </computeroutput> + </para> + + <para> + which has no parameters. + </para> + + <para> + <emphasis role="bold">Reading.</emphasis> There are three calls to read from the stream. + </para> + <para> + <computeroutput> + public synchronized int read() + throws IOException + </computeroutput> + </para> + + <para> + which has no parameters. + </para> + + <para> + <computeroutput> + public synchronized int read(byte[] b) + throws IOException + </computeroutput> + </para> + + <para> + where: + </para> + <itemizedlist> + <listitem> + <para> + <computeroutput>b</computeroutput> is a byte array to write to. + </para> + </listitem> + </itemizedlist> + + + <para> + <computeroutput> + public synchronized int read(byte[] b, int off, int len) + throws IOException + </computeroutput> + </para> + + <para> + where: + </para> + <itemizedlist> + <listitem> + <para> + <computeroutput>b</computeroutput> is a byte array to write to. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>off</computeroutput> is an offset for byte array <computeroutput>b</computeroutput>. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>len</computeroutput> is the length in bytes to write to <computeroutput>b</computeroutput>. + </para> + </listitem> + </itemizedlist> + + + </section> + </article> \ No newline at end of file Modified: hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/index.xml URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/index.xml?rev=911712&r1=911711&r2=911712&view=diff ============================================================================== --- hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/index.xml (original) +++ hadoop/zookeeper/trunk/src/docs/src/documentation/content/xdocs/index.xml Fri Feb 19 06:25:46 2010 @@ -89,6 +89,7 @@ <li><a href="bookkeeperOverview.html">henn, what's it again?</a></li> <li><a href="bookkeeperStarted.html">Ok, now how do I try it out</a></li> <li><a href="bookkeeperProgrammer.html">Awesome, but how do I integrate it with my app?</a></li> + <li><a href="bookkeeperStream.html">Can I stream bytes instead of entries?</a></li> </ul> </li> </ul>