</head>
<body>
-<h1>Blërg Documentation</h1>
+<h1>Blërg</h1>
+
+Blërg is a minimalistic tagged text document database engine that also
+pretends to be a <a href="/">microblogging system</a>. It is designed
+to efficiently store small (< 64K) pieces of text in a way that they
+can be quickly retrieved by record number or by querying for tags
+embedded in the text. Its native interface is HTTP — Blërg comes
+as either a standalone HTTP server, or a CGI. Blërg is written in pure
+C.
+
+<ul class="toc">
+ <li><a href="#installing">Installing</a>
+ <ul>
+ <li><a href="#getting_the_source">Getting the source</a></li>
+ <li><a href="#requirements">Requirements</a></li>
+ <li><a href="#configuring">Configuring</a></li>
+ <li><a href="#building">Building</a></li>
+ <li><a href="#installing">Installing</a></li>
+ </ul>
+ </li>
+ <li><a href="#design">Design</a>
+ <ul>
+ <li><a href="#motivation">Motivation</a></li>
+ <li><a href="#web_app_stack">Web App Stack</a></li>
+ <li><a href="#database">Database</a></li>
+ <li><a href="#problems_and_future_work">Problems and Future Work</a></li>
+ </ul>
+ </li>
+</ul>
-<h2>Installing</h2>
+<h2><a name="installing">Installing</a></h2>
-<h3>Getting the source</h3>
+<h3><a name="getting_the_source">Getting the source</a></h3>
<p>There's no stable release, yet, but you can get everything currently
running on blerg.dominionofawesome.com by cloning the git repository at
http://git.bytex64.net/blerg.git.
-<h3>Requirements</h3>
+<h3><a name="requirements">Requirements</a></h3>
<p>Blërg has varying requirements depending on how you want to run it
— as a standalone HTTP server, or as a CGI. You will need:
<li><a href="http://www.newbreedsoftware.com/cgi-util/download/">cgi-util</a> >= 2.2.1</li>
</ul>
-<h3>Configuring</h3>
+<h3><a name="configuring">Configuring</a></h3>
<p>I know I'm gonna get shit for not using an autoconf-based system, but
I really didn't want to waste time figuring it out. You should edit
suggestions on how to make Blërg more portable, I'd be happy to hear
them.
-<h3>Building</h3>
+<h3><a name="building">Building</a></h3>
<p>At this point, it should be gravy. Type 'make' and in a few seconds,
you should have <code>http_blerg</code>, <code>cgi_blerg</code>,
individually as well, if you, for example, don't want to install the
prerequisites for <code>http_blerg</code> or <code>cgi_blerg</code>.
-<h3>Installing</h3>
+<h3><a name="installing">Installing</a></h3>
<p>While it's not required, Blërg will be easier to set up if you
configure it to work from the root of your website. For this reason,
it's at /rss.cgi).
-<h2>Design</h2>
+<h2><a name="design">Design</a></h2>
-<h3>Motivation</h3>
+<h3><a name="motivation">Motivation</a></h3>
<p>Blërg was created as the result of a thought experiment: "What if
Twitter didn't need thousands of servers? What if its millions of users
could be handled by a single highly efficient server?" This is probably
an unreachable goal due to the sheer amount of I/O, but we could
-certainly do better. Blërg was designed with very simple requirements:
+certainly do better. Blërg was thus designed as a system with very
+simple requirements:
<ol>
<li>Store and fetch small chunks of text efficiently</li>
<p>And to further simplify, I didn't bother handling deletes, full text
search, or more complicated tag searches. Blërg only does the basics.
-<h3>Web App Stack</h3>
+<h3><a name="web_app_stack">Web App Stack</a></h3>
<table class="pizzapie">
<tr><th>Classical model</th></tr>
href="http://couchdb.apache.org/">CouchDB</a>, though I didn't know that
until after I wrote Blërg. :)
-<h3>Database</h3>
+<h3><a name="database">Database</a></h3>
<p>Early in the design process, I decided to blatantly copy <a
href="http://www.varnish-cache.org/">varnish</a> and rely heavily on
searched by opening the tag file, reading the last 50 entries or so, and
then reading all the records listed. Voila, fast tag lookups.
+<p>At this point, you're probably thinking, "Is that it?" Yep, that's
+it. Blërg isn't revolutionary, it's just a system whose requirements
+were pared down until the implementation could be made dead simple.
+
<p>Also, keeping with the style of modern object databases, I haven't
implemented any data safety (har har). Blërg does not sync anything to
disk before returning success. This should make Blërg extremely fast,
and totally unreliable in a crash. But that's the way you want it,
right? :]
-<h3>Problems and Future Work</h3>
+<h3><a name="problems_and_future_work">Problems and Future Work</a></h3>
+
+<p>Blërg probably doesn't actually work like Twitter because I've never
+actually had a Twitter account.
<p>I couldn't find a really good fast HTTP server library.
Libmicrohttpd is small, but it's focused on embedded applications, so it