summaryrefslogtreecommitdiff
path: root/code/spyglass/lib/spyglass.rb
diff options
context:
space:
mode:
Diffstat (limited to 'code/spyglass/lib/spyglass.rb')
-rw-r--r--code/spyglass/lib/spyglass.rb53
1 files changed, 53 insertions, 0 deletions
diff --git a/code/spyglass/lib/spyglass.rb b/code/spyglass/lib/spyglass.rb
new file mode 100644
index 0000000..0e3f9ba
--- /dev/null
+++ b/code/spyglass/lib/spyglass.rb
@@ -0,0 +1,53 @@
+# Spyglass
+# ========
+#
+# This is Spyglass, a Rack web server that rides on Unix designed to be simple and teach
+# others about Unix programming.
+#
+# It's namesake comes from the fact that when it boots up it's nothing more than a lone socket
+# keeping a lookout for incoming connections.
+#
+# When a connection comes in it spins up a Master
+# process which preforks some workers to actually handle http requests. If the Master process is
+# left idle long enough it will shut itself (and it's workers) down and go back to just a lone
+# listening socket, on the lookout for incoming connections.
+#
+# Components
+# ==========
+#
+# * [Server](server.html) gets the ball rolling.
+# The role of Server is pretty minimal. It opens the initial listening TCP socket,
+# then passes that socket onto the Lookout. The Lookout will actually handle reading
+# from the socket.
+#
+# * [Lookout](lookout.html) keeps a watch and notifies others when a connection
+# comes in.
+# The Lookout is a pretty 'dumb' object. All that it does is listen for incoming
+# connections on the socket it's given. Once it receives a connection it does a fork(2)
+# and invokes a Master process. The Master process actually handles the connection.
+#
+# * [Master](master.html) loads the application and babysits worker processes
+# that actually talk to clients.
+# The role of the Master class is to create and babysit worker processes
+# that will actually handle web requests. The Master itself doesn't know
+# anything about http, etc. it just knows how to manage processes.
+#
+# * [Worker](worker.html) parses HTTP, calls the app, and writes back to the client.
+require 'singleton'
+require 'socket'
+require 'stringio'
+
+require 'rack/server'
+require 'rack/builder'
+
+require 'spyglass_parser'
+require 'spyglass/configurator'
+require 'spyglass/logging'
+require 'spyglass/server'
+require 'spyglass/lookout'
+require 'spyglass/master'
+require 'spyglass/worker'
+
+module Spyglass
+ Version = '0.1.1'
+end