IOWA 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTORS +14 -0
- data/README.md +23 -0
- data/RELEASE_NOTES +77 -0
- data/ToDo +21 -0
- data/components/CRUDList/CRUDList.html +13 -0
- data/components/CRUDList/CRUDList.iwa +136 -0
- data/components/Content/Content.html +0 -0
- data/components/Content/Content.iwa +143 -0
- data/components/Content/example/README +9 -0
- data/components/Content/example/cgi/iowa.cgi +10 -0
- data/components/Content/example/demo.rb +30 -0
- data/components/Content/example/doc/index.html +7 -0
- data/components/Content/example/iowa/Content.html +1 -0
- data/components/Content/example/iowa/Content.iwa +1 -0
- data/components/Content/example/iowa/Main.html +6 -0
- data/components/Content/example/iowa/Main.iwa +3 -0
- data/components/Content/example/iowa/_content/body +7 -0
- data/components/Content/example/iowa/_content/body2 +3 -0
- data/components/Content/example/iowa/_content/title +2 -0
- data/components/Content/example/iowa/app.cnf +8 -0
- data/components/Content/example/iowa/app.rb +8 -0
- data/components/Content/example/webrick.rb +38 -0
- data/components/Include/Include.html +1 -0
- data/components/Include/Include.iwa +30 -0
- data/components/Include/readme +5 -0
- data/components/JumpTo/JumpTo.html +8 -0
- data/components/JumpTo/JumpTo.iwa +8 -0
- data/components/JumpTo/readme +6 -0
- data/doc/Architecture.txt +6 -0
- data/doc/History.txt +33 -0
- data/doc/StandardDispatcher.txt +19 -0
- data/examples/blog/README +1 -0
- data/examples/hello_world/README +17 -0
- data/examples/hello_world/htdocs/hello_world_html.html +24 -0
- data/examples/hello_world/htdocs/hello_world_ruby.html +41 -0
- data/examples/hello_world/iowa/HelloWorld.html +14 -0
- data/examples/hello_world/iowa/HelloWorld.iwa +31 -0
- data/examples/hello_world/iowa/Index.html +16 -0
- data/examples/hello_world/iowa/Index.iwa +5 -0
- data/examples/hello_world/iowa/iowa_hello_world.cnf +19 -0
- data/examples/hello_world/iowa/iowa_hello_world.rb +5 -0
- data/examples/hello_world/iowa/mapfile.cnf +6 -0
- data/examples/hw1/iowa/Main.html +1 -0
- data/examples/hw1/iowa/README +9 -0
- data/examples/hw1/iowa/hw.rb +4 -0
- data/examples/hw2/iowa/Main.html +10 -0
- data/examples/hw2/iowa/Main.iwa +7 -0
- data/examples/hw2/iowa/README +16 -0
- data/examples/hw2/iowa/hw.rb +4 -0
- data/examples/hw3/iowa/Main.html +11 -0
- data/examples/hw3/iowa/Main.iwa +7 -0
- data/examples/hw3/iowa/README +22 -0
- data/examples/hw3/iowa/hw.rb +4 -0
- data/examples/hw4/iowa/Greetings.html +10 -0
- data/examples/hw4/iowa/Greetings.iwa +9 -0
- data/examples/hw4/iowa/Main.html +12 -0
- data/examples/hw4/iowa/Main.iwa +10 -0
- data/examples/hw4/iowa/README +28 -0
- data/examples/hw4/iowa/hw.rb +4 -0
- data/examples/hw5/iowa/Footer.html +2 -0
- data/examples/hw5/iowa/Greetings.html +4 -0
- data/examples/hw5/iowa/Greetings.iwa +12 -0
- data/examples/hw5/iowa/Header.html +6 -0
- data/examples/hw5/iowa/Main.html +12 -0
- data/examples/hw5/iowa/Main.iwa +13 -0
- data/examples/hw5/iowa/README +16 -0
- data/examples/hw5/iowa/hw.rb +4 -0
- data/examples/template_server/iowa/Content.iwa +121 -0
- data/examples/template_server/iowa/Content.view +0 -0
- data/examples/template_server/iowa/DBContentDispatcher.rb +112 -0
- data/examples/template_server/iowa/DBContentPage.html +3 -0
- data/examples/template_server/iowa/DBContentPage.iwa +85 -0
- data/examples/template_server/iowa/app.cnf +13 -0
- data/examples/template_server/iowa/app.rb +5 -0
- data/ext/Classifier/classifier.c +256 -0
- data/ext/Classifier/ext_help.h +14 -0
- data/ext/Classifier/extconf.rb +5 -0
- data/ext/Classifier/tst.h +40 -0
- data/ext/Classifier/tst_cleanup.c +24 -0
- data/ext/Classifier/tst_delete.c +146 -0
- data/ext/Classifier/tst_grow_node_free_list.c +38 -0
- data/ext/Classifier/tst_init.c +41 -0
- data/ext/Classifier/tst_insert.c +192 -0
- data/ext/Classifier/tst_search.c +68 -0
- data/ext/http11/README +11 -0
- data/ext/http11/ext_help.h +15 -0
- data/ext/http11/extconf.rb +5 -0
- data/ext/http11/http11.c +534 -0
- data/ext/http11/http11.c.dif +422 -0
- data/ext/http11/http11_parser.c +1243 -0
- data/ext/http11/http11_parser.c.dif +193 -0
- data/ext/http11/http11_parser.h +49 -0
- data/ext/http11/http11_parser.h.dif +20 -0
- data/ext/http11/http11_parser.rl +192 -0
- data/ext/httpmachine/Makefile +149 -0
- data/ext/httpmachine/extconf.rb +33 -0
- data/ext/httpmachine/http.cpp +430 -0
- data/ext/httpmachine/http.h +156 -0
- data/ext/httpmachine/rubyhttp.cpp +165 -0
- data/external/mime-types/LICENCE +18 -0
- data/external/mime-types/README +46 -0
- data/external/mime-types/doc/classes/MIME.html +120 -0
- data/external/mime-types/doc/classes/MIME/InvalidContentType.html +119 -0
- data/external/mime-types/doc/classes/MIME/Type.html +866 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000010.html +22 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000011.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000012.html +19 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000013.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000014.html +26 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000015.html +33 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000016.html +27 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000017.html +35 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000018.html +34 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000019.html +24 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000020.html +38 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000021.html +22 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000022.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000023.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000024.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000025.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000026.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000027.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000028.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000029.html +18 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000030.html +19 -0
- data/external/mime-types/doc/classes/MIME/Type.src/M000031.html +26 -0
- data/external/mime-types/doc/classes/MIME/Types.html +459 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000001.html +19 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000002.html +32 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000003.html +21 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000004.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000005.html +26 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000006.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000007.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000008.html +18 -0
- data/external/mime-types/doc/classes/MIME/Types.src/M000009.html +18 -0
- data/external/mime-types/doc/created.rid +1 -0
- data/external/mime-types/doc/files/ChangeLog.html +320 -0
- data/external/mime-types/doc/files/README.html +145 -0
- data/external/mime-types/doc/files/lib/mime/types_rb.html +101 -0
- data/external/mime-types/doc/fr_class_index.html +30 -0
- data/external/mime-types/doc/fr_file_index.html +29 -0
- data/external/mime-types/doc/fr_method_index.html +57 -0
- data/external/mime-types/doc/index.html +24 -0
- data/external/mime-types/doc/rdoc-style.css +208 -0
- data/external/mime-types/lib/mime/types.rb +1558 -0
- data/external/package.rb +672 -0
- data/external/test_support.rb +95 -0
- data/external/tmail/README +7 -0
- data/external/tmail/tmail.rb +4 -0
- data/external/tmail/tmail/address.rb +222 -0
- data/external/tmail/tmail/base64.rb +52 -0
- data/external/tmail/tmail/compat.rb +39 -0
- data/external/tmail/tmail/config.rb +50 -0
- data/external/tmail/tmail/encode.rb +447 -0
- data/external/tmail/tmail/header.rb +895 -0
- data/external/tmail/tmail/info.rb +14 -0
- data/external/tmail/tmail/loader.rb +1 -0
- data/external/tmail/tmail/mail.rb +869 -0
- data/external/tmail/tmail/mailbox.rb +386 -0
- data/external/tmail/tmail/mbox.rb +1 -0
- data/external/tmail/tmail/net.rb +260 -0
- data/external/tmail/tmail/obsolete.rb +123 -0
- data/external/tmail/tmail/parser.rb +1475 -0
- data/external/tmail/tmail/parser.y +372 -0
- data/external/tmail/tmail/port.rb +356 -0
- data/external/tmail/tmail/scanner.rb +17 -0
- data/external/tmail/tmail/scanner_r.rb +243 -0
- data/external/tmail/tmail/stringio.rb +256 -0
- data/external/tmail/tmail/textutils.rb +197 -0
- data/external/tmail/tmail/tmail.rb +1 -0
- data/external/tmail/tmail/utils.rb +23 -0
- data/external/win32-process/README +133 -0
- data/external/win32-process/lib/win32/process.rb +561 -0
- data/external/windows-pr/README +145 -0
- data/external/windows-pr/doc/conversion_guide.txt +25 -0
- data/external/windows-pr/lib/windows/clipboard.rb +72 -0
- data/external/windows-pr/lib/windows/console.rb +323 -0
- data/external/windows-pr/lib/windows/device_io.rb +88 -0
- data/external/windows-pr/lib/windows/directory.rb +80 -0
- data/external/windows-pr/lib/windows/error.rb +313 -0
- data/external/windows-pr/lib/windows/eventlog.rb +120 -0
- data/external/windows-pr/lib/windows/file.rb +349 -0
- data/external/windows-pr/lib/windows/filesystem.rb +16 -0
- data/external/windows-pr/lib/windows/handle.rb +31 -0
- data/external/windows-pr/lib/windows/library.rb +76 -0
- data/external/windows-pr/lib/windows/limits.rb +13 -0
- data/external/windows-pr/lib/windows/memory.rb +117 -0
- data/external/windows-pr/lib/windows/msvcrt/buffer.rb +48 -0
- data/external/windows-pr/lib/windows/msvcrt/file.rb +18 -0
- data/external/windows-pr/lib/windows/msvcrt/string.rb +46 -0
- data/external/windows-pr/lib/windows/national.rb +557 -0
- data/external/windows-pr/lib/windows/path.rb +296 -0
- data/external/windows-pr/lib/windows/pipe.rb +77 -0
- data/external/windows-pr/lib/windows/process.rb +171 -0
- data/external/windows-pr/lib/windows/registry.rb +238 -0
- data/external/windows-pr/lib/windows/security.rb +89 -0
- data/external/windows-pr/lib/windows/service.rb +183 -0
- data/external/windows-pr/lib/windows/shell.rb +88 -0
- data/external/windows-pr/lib/windows/sound.rb +52 -0
- data/external/windows-pr/lib/windows/synchronize.rb +161 -0
- data/external/windows-pr/lib/windows/system_info.rb +70 -0
- data/external/windows-pr/lib/windows/unicode.rb +138 -0
- data/external/windows-pr/lib/windows/window.rb +22 -0
- data/iowa.gemspec +45 -0
- data/microprojects/DiskCache/LICENSE +28 -0
- data/microprojects/DiskCache/README +17 -0
- data/microprojects/DiskCache/external/package.rb +608 -0
- data/microprojects/DiskCache/external/test_support.rb +8 -0
- data/microprojects/DiskCache/setup.rb +22 -0
- data/microprojects/DiskCache/src/iowa/Association.rb +67 -0
- data/microprojects/DiskCache/src/iowa/Constants.rb +159 -0
- data/microprojects/DiskCache/src/iowa/DiskStore.rb +377 -0
- data/microprojects/DiskCache/src/iowa/Hash.rb +63 -0
- data/microprojects/DiskCache/src/iowa/Lockfile.rb +575 -0
- data/microprojects/DiskCache/src/iowa/Mutex.rb +142 -0
- data/microprojects/DiskCache/src/iowa/caches/DiskCache.rb +605 -0
- data/microprojects/DiskCache/src/iowa/caches/LRUCache.rb +287 -0
- data/microprojects/DiskCache/test/TC_DiskCache.rb +218 -0
- data/microprojects/LRUCache/LICENSE +28 -0
- data/microprojects/LRUCache/README +13 -0
- data/microprojects/LRUCache/external/package.rb +608 -0
- data/microprojects/LRUCache/external/test_support.rb +8 -0
- data/microprojects/LRUCache/setup.rb +22 -0
- data/microprojects/LRUCache/src/iowa/Association.rb +57 -0
- data/microprojects/LRUCache/src/iowa/Constants.rb +159 -0
- data/microprojects/LRUCache/src/iowa/Hash.rb +63 -0
- data/microprojects/LRUCache/src/iowa/Mutex.rb +129 -0
- data/microprojects/LRUCache/src/iowa/caches/LRUCache.rb +287 -0
- data/microprojects/LRUCache/test/TC_LRUCache.rb +65 -0
- data/microprojects/LinkedList/LICENSE +28 -0
- data/microprojects/LinkedList/README +13 -0
- data/microprojects/LinkedList/external/package.rb +608 -0
- data/microprojects/LinkedList/external/test_support.rb +8 -0
- data/microprojects/LinkedList/setup.rb +22 -0
- data/microprojects/LinkedList/src/iowa/LinkedList.rb +165 -0
- data/microprojects/LinkedList/test/TC_LinkedList.rb +42 -0
- data/microprojects/README +8 -0
- data/setup.rb +116 -0
- data/share/iowa/app_skeleton/Main.html +8 -0
- data/share/iowa/app_skeleton/Main.iwa +15 -0
- data/share/iowa/app_skeleton/app.cnf +48 -0
- data/share/iowa/app_skeleton/app.rb +58 -0
- data/share/iowa/app_skeleton/models/model.rb +49 -0
- data/src/ihc.rb +223 -0
- data/src/iowa.cgi +29 -0
- data/src/iowa.rb +637 -0
- data/src/iowa/AbstractCache.rb +96 -0
- data/src/iowa/AcceptLanguage.rb +76 -0
- data/src/iowa/Application.rb +928 -0
- data/src/iowa/ApplicationStats.rb +72 -0
- data/src/iowa/Association.rb +67 -0
- data/src/iowa/BindingsParser.rb +62 -0
- data/src/iowa/Breakpoint.rb +273 -0
- data/src/iowa/CSS.rb +564 -0
- data/src/iowa/Client.rb +192 -0
- data/src/iowa/Component.rb +405 -0
- data/src/iowa/ComponentProxy.rb +26 -0
- data/src/iowa/Config.rb +21 -0
- data/src/iowa/Constants.rb +226 -0
- data/src/iowa/Context.rb +218 -0
- data/src/iowa/ContextLogger.rb +16 -0
- data/src/iowa/DbPool.rb +222 -0
- data/src/iowa/DetachedComponent.rb +18 -0
- data/src/iowa/Dispatcher.rb +27 -0
- data/src/iowa/DynamicElements.rb +471 -0
- data/src/iowa/Element.rb +100 -0
- data/src/iowa/Email.rb +287 -0
- data/src/iowa/Extensions/AllExtensions.rb +4 -0
- data/src/iowa/Extensions/Class.rb +94 -0
- data/src/iowa/Extensions/Date.rb +88 -0
- data/src/iowa/Extensions/DateTime.rb +88 -0
- data/src/iowa/Extensions/Hash.rb +22 -0
- data/src/iowa/Extensions/Kernel.rb +6 -0
- data/src/iowa/Extensions/Numeric.rb +47 -0
- data/src/iowa/Extensions/Object.rb +11 -0
- data/src/iowa/Extensions/String.rb +60 -0
- data/src/iowa/Extensions/Time.rb +89 -0
- data/src/iowa/Extensions/TimeExtensions.rb +6 -0
- data/src/iowa/Form.rb +368 -0
- data/src/iowa/Hash.rb +85 -0
- data/src/iowa/ISAAC.rb +175 -0
- data/src/iowa/ImageSize.rb +279 -0
- data/src/iowa/IowaComponentMixins.rb +7 -0
- data/src/iowa/JSON-lexer.rb +296 -0
- data/src/iowa/JSON-objects.rb +201 -0
- data/src/iowa/KeyValueCoding.rb +91 -0
- data/src/iowa/LinkedList.rb +175 -0
- data/src/iowa/Loader.rb +22 -0
- data/src/iowa/Lockfile.rb +575 -0
- data/src/iowa/Logger.rb +74 -0
- data/src/iowa/Monkey.rb +20 -0
- data/src/iowa/Mutex.rb +142 -0
- data/src/iowa/Policy.rb +70 -0
- data/src/iowa/Pool.rb +243 -0
- data/src/iowa/PrettyException.rb +1091 -0
- data/src/iowa/Request.rb +244 -0
- data/src/iowa/Response.rb +133 -0
- data/src/iowa/Session.rb +354 -0
- data/src/iowa/SessionStats.rb +78 -0
- data/src/iowa/String.rb +65 -0
- data/src/iowa/Tag.rb +101 -0
- data/src/iowa/TemplateParser.rb +236 -0
- data/src/iowa/Util.rb +314 -0
- data/src/iowa/Webcache.rb +122 -0
- data/src/iowa/caches/BiLevelCache.rb +65 -0
- data/src/iowa/caches/ClassLimitedCache.rb +67 -0
- data/src/iowa/caches/DiskCache.rb +609 -0
- data/src/iowa/caches/DiskStore.rb +380 -0
- data/src/iowa/caches/LRUCache-alternative.rb +155 -0
- data/src/iowa/caches/LRUCache.rb +290 -0
- data/src/iowa/caches/SimpleLRUCache.rb +112 -0
- data/src/iowa/dispatchers/StandardDispatcher.rb +396 -0
- data/src/iowa/dispatchers/StandardDispatcherWithClassifier.rb +93 -0
- data/src/iowa/js/iowa_jsonrpc.js +381 -0
- data/src/iowa/js/jsonrpc.js +187 -0
- data/src/iowa/js/jsonrpc_async.js +261 -0
- data/src/iowa/loaders/DiskLoader.rb +50 -0
- data/src/iowa/loggers/Analogger.rb +54 -0
- data/src/iowa/loggers/AsyncLogger.rb +54 -0
- data/src/iowa/loggers/BitBucket.rb +38 -0
- data/src/iowa/loggers/Log4R.rb +13 -0
- data/src/iowa/loggers/Log4rLogger.rb +48 -0
- data/src/iowa/loggers/Logger.rb +29 -0
- data/src/iowa/loggers/RubyLogger.rb +9 -0
- data/src/iowa/pools/DBConnectionPool.rb +53 -0
- data/src/iowa/request/Apache.rb +90 -0
- data/src/iowa/request/EMHybrid.rb +59 -0
- data/src/iowa/request/ENV.rb +80 -0
- data/src/iowa/request/FCGI.rb +68 -0
- data/src/iowa/request/HTTPMachine.rb +75 -0
- data/src/iowa/request/Mongrel.rb +68 -0
- data/src/iowa/request/WEBrick.rb +48 -0
- data/src/iowa/version.rb +3 -0
- data/src/iowa/webrick/HTTPServer.rb +43 -0
- data/src/iowa/webrick/WEBrickServlet.rb +28 -0
- data/src/iowa_fcgi_handler.rb +101 -0
- data/src/iowa_httpmachine.rb +141 -0
- data/src/iowa_hybrid.rb +193 -0
- data/src/iowa_hybrid_cluster.rb +231 -0
- data/src/iowa_mongrel.rb +136 -0
- data/src/iowa_webrick.rb +194 -0
- data/src/iowa_webrick_legacy.rb +104 -0
- data/src/mod_iowa.rb +104 -0
- data/tcss.rb +61 -0
- data/test/README.windows +12 -0
- data/test/TC_AcceptLanguage.rb +61 -0
- data/test/TC_AppConfig.rb +43 -0
- data/test/TC_AppConfig/cgi/iowa.cgi +7 -0
- data/test/TC_AppConfig/doc/index.html +1 -0
- data/test/TC_AppConfig/iowa/Main.html +4 -0
- data/test/TC_AppConfig/iowa/Main.iwa +17 -0
- data/test/TC_AppConfig/iowa/README +1 -0
- data/test/TC_AppConfig/iowa/app.cnf +19 -0
- data/test/TC_AppConfig/iowa/app.rb +8 -0
- data/test/TC_AppConfig/webrick.rb +38 -0
- data/test/TC_Association.rb +29 -0
- data/test/TC_BiLevelCache.rb +71 -0
- data/test/TC_CGI_Adaptor.rb +55 -0
- data/test/TC_CGI_Adaptor/cgi/iowa.cgi +7 -0
- data/test/TC_CGI_Adaptor/doc/index.html +1 -0
- data/test/TC_CGI_Adaptor/iowa/Main.html +8 -0
- data/test/TC_CGI_Adaptor/iowa/Main.iwa +14 -0
- data/test/TC_CGI_Adaptor/iowa/README +1 -0
- data/test/TC_CGI_Adaptor/iowa/app.cnf +8 -0
- data/test/TC_CGI_Adaptor/iowa/app.rb +8 -0
- data/test/TC_CGI_Adaptor/webrick.rb +38 -0
- data/test/TC_CSS.rb +660 -0
- data/test/TC_ClassLimitedCache.rb +89 -0
- data/test/TC_Classifier.rb +80 -0
- data/test/TC_DbPool.rb +127 -0
- data/test/TC_DiskCache.rb +218 -0
- data/test/TC_Hybrid.rb +58 -0
- data/test/TC_Hybrid/doc/thing.txt +1 -0
- data/test/TC_Hybrid/iowa/Main.html +3 -0
- data/test/TC_Hybrid/iowa/Main.iwa +7 -0
- data/test/TC_Hybrid/iowa/NewPage.html +1 -0
- data/test/TC_Hybrid/iowa/NewPage.iwa +5 -0
- data/test/TC_Hybrid/iowa/app.cnf +10 -0
- data/test/TC_Hybrid/iowa/app.rb +5 -0
- data/test/TC_IOWAFunctions/doc/Ajax1.html +1 -0
- data/test/TC_IOWAFunctions/doc/Ajax1.iwa +1 -0
- data/test/TC_IOWAFunctions/doc/index.html +1 -0
- data/test/TC_IOWAFunctions/doc/js/dojo.js +9686 -0
- data/test/TC_IOWAFunctions/iowa/Ajax1.html +40 -0
- data/test/TC_IOWAFunctions/iowa/Ajax1.iwa +23 -0
- data/test/TC_IOWAFunctions/iowa/AjaxWidget.iwa +19 -0
- data/test/TC_IOWAFunctions/iowa/AjaxWidget.view +22 -0
- data/test/TC_IOWAFunctions/iowa/DanielTest.html +9 -0
- data/test/TC_IOWAFunctions/iowa/DanielTest.iwa +10 -0
- data/test/TC_IOWAFunctions/iowa/IntervalWidget.html +1 -0
- data/test/TC_IOWAFunctions/iowa/IntervalWidget.iwa +14 -0
- data/test/TC_IOWAFunctions/iowa/Main.html +1 -0
- data/test/TC_IOWAFunctions/iowa/NestedRepeat1.html +12 -0
- data/test/TC_IOWAFunctions/iowa/NestedRepeat1.iwa +24 -0
- data/test/TC_IOWAFunctions/iowa/RPCResponse.iwa +7 -0
- data/test/TC_IOWAFunctions/iowa/RPCResponse.view +1 -0
- data/test/TC_IOWAFunctions/iowa/Repeat1.iwa +31 -0
- data/test/TC_IOWAFunctions/iowa/Repeat1.view +9 -0
- data/test/TC_IOWAFunctions/iowa/Repeat2.iwa +32 -0
- data/test/TC_IOWAFunctions/iowa/Repeat2.view +11 -0
- data/test/TC_IOWAFunctions/iowa/Repeat3.iwa +44 -0
- data/test/TC_IOWAFunctions/iowa/Repeat3.view +18 -0
- data/test/TC_IOWAFunctions/iowa/TesCon.html +1 -0
- data/test/TC_IOWAFunctions/iowa/TesCon.iwa +5 -0
- data/test/TC_IOWAFunctions/iowa/app.cnf +19 -0
- data/test/TC_IOWAFunctions/iowa/app.rb +9 -0
- data/test/TC_IOWAFunctions/iowa/mapfile.cnf +8 -0
- data/test/TC_ISAAC.rb +52 -0
- data/test/TC_ImageSize.rb +84 -0
- data/test/TC_ImageSize/img.bmp +0 -0
- data/test/TC_ImageSize/img.gif +0 -0
- data/test/TC_ImageSize/img.jpg +0 -0
- data/test/TC_ImageSize/img.pcx +0 -0
- data/test/TC_ImageSize/img.pgm +7144 -0
- data/test/TC_ImageSize/img.png +0 -0
- data/test/TC_ImageSize/img.ppm +0 -0
- data/test/TC_ImageSize/img.psd +0 -0
- data/test/TC_ImageSize/img.tiff +0 -0
- data/test/TC_ImageSize/img.xbm +22 -0
- data/test/TC_KeyValueCoding.rb +35 -0
- data/test/TC_LRUCache.rb +296 -0
- data/test/TC_LinkedList.rb +46 -0
- data/test/TC_Lockfile.rb +106 -0
- data/test/TC_Minimal.rb +45 -0
- data/test/TC_Minimal/app.cnf +8 -0
- data/test/TC_Minimal/cgi-bin/iowa.cgi +11 -0
- data/test/TC_Minimal/doc/index.html +1 -0
- data/test/TC_Minimal/iowa/Main.html +1 -0
- data/test/TC_Minimal/iowa/README +1 -0
- data/test/TC_Minimal/iowa/app.rb +3 -0
- data/test/TC_Minimal/webrick.rb +38 -0
- data/test/TC_Mongrel.rb +58 -0
- data/test/TC_Mongrel/doc/thing.txt +1 -0
- data/test/TC_Mongrel/iowa/Main.html +3 -0
- data/test/TC_Mongrel/iowa/Main.iwa +7 -0
- data/test/TC_Mongrel/iowa/NewPage.html +1 -0
- data/test/TC_Mongrel/iowa/NewPage.iwa +5 -0
- data/test/TC_Mongrel/iowa/app.cnf +10 -0
- data/test/TC_Mongrel/iowa/app.rb +5 -0
- data/test/TC_NoSubclass.rb +56 -0
- data/test/TC_NoSubclass/cgi/iowa.cgi +7 -0
- data/test/TC_NoSubclass/doc/index.html +1 -0
- data/test/TC_NoSubclass/iowa/Main.html +8 -0
- data/test/TC_NoSubclass/iowa/Main.iwa +14 -0
- data/test/TC_NoSubclass/iowa/README +1 -0
- data/test/TC_NoSubclass/iowa/app.cnf +8 -0
- data/test/TC_NoSubclass/iowa/app.rb +5 -0
- data/test/TC_NoSubclass/webrick.rb +38 -0
- data/test/TC_Pool.rb +139 -0
- data/test/TC_RenderedCache/doc/thing.txt +1 -0
- data/test/TC_RenderedCache/iowa/BigPage.html +1 -0
- data/test/TC_RenderedCache/iowa/BigPage.iwa +12 -0
- data/test/TC_RenderedCache/iowa/Main.html +3 -0
- data/test/TC_RenderedCache/iowa/Main.iwa +7 -0
- data/test/TC_RenderedCache/iowa/NewPage.html +1 -0
- data/test/TC_RenderedCache/iowa/NewPage.iwa +11 -0
- data/test/TC_RenderedCache/iowa/app.cnf +13 -0
- data/test/TC_RenderedCache/iowa/app.rb +5 -0
- data/test/TC_RenderedCache/iowa/mapfile.map +4 -0
- data/test/TC_ResourceURL.rb +73 -0
- data/test/TC_ResourceURL/iowa/Main.html +2 -0
- data/test/TC_ResourceURL/iowa/Main.iwa +10 -0
- data/test/TC_ResourceURL/iowa/app.cnf +10 -0
- data/test/TC_ResourceURL/iowa/app.rb +5 -0
- data/test/TC_SimpleDetached.rb +41 -0
- data/test/TC_StandardDispatcher.rb +362 -0
- data/test/TC_StandardDispatcherWithClassifier.rb +358 -0
- data/test/TC_String.rb +24 -0
- data/test/TC_Tag.rb +41 -0
- data/test/TC_Webrick.rb +56 -0
- data/test/TC_Webrick/doc/thing.txt +1 -0
- data/test/TC_Webrick/iowa/Main.html +3 -0
- data/test/TC_Webrick/iowa/Main.iwa +7 -0
- data/test/TC_Webrick/iowa/NewPage.html +1 -0
- data/test/TC_Webrick/iowa/NewPage.iwa +5 -0
- data/test/TC_Webrick/iowa/app.cnf +10 -0
- data/test/TC_Webrick/iowa/app.rb +5 -0
- data/test/tc_template.rb +15 -0
- data/test/tests.conf +19 -0
- data/utils/CVS/Entries +3 -0
- data/utils/CVS/Repository +1 -0
- data/utils/CVS/Root +1 -0
- data/utils/QuickCert-1.0.2.tar.gz +0 -0
- data/utils/QuickCert-1.0.2/InstalledFiles +7 -0
- data/utils/QuickCert-1.0.2/MANIFEST +10 -0
- data/utils/QuickCert-1.0.2/Makefile +15 -0
- data/utils/QuickCert-1.0.2/README +56 -0
- data/utils/QuickCert-1.0.2/bin/QuickCert +355 -0
- data/utils/QuickCert-1.0.2/config.save +12 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/README +60 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/drbssl_c.rb +26 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/drbssl_s.rb +35 -0
- data/utils/QuickCert-1.0.2/data/examples/ruby/QuickCert/qc_config +21 -0
- data/utils/QuickCert-1.0.2/lib/QuickCert/defaults.rb +28 -0
- data/utils/QuickCert-1.0.2/setup.rb +1312 -0
- data/utils/iowa_apps +422 -0
- data/utils/smtp_sink.rb +9 -0
- data/utils/startup_template.cnf +27 -0
- data/utils/startup_template.rb +73 -0
- metadata +551 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
#!ruby
|
2
|
+
|
3
|
+
basedir = File.dirname(__FILE__)
|
4
|
+
$:.push(basedir)
|
5
|
+
|
6
|
+
require 'external/package'
|
7
|
+
require 'rbconfig'
|
8
|
+
begin
|
9
|
+
require 'rubygems'
|
10
|
+
rescue LoadError
|
11
|
+
end
|
12
|
+
|
13
|
+
Dir.chdir(basedir)
|
14
|
+
Package.setup("1.0") {
|
15
|
+
name "Iowa::LinkedList"
|
16
|
+
|
17
|
+
translate(:lib, 'src/' => '')
|
18
|
+
lib *Dir["src/iowa/**/*.rb"]
|
19
|
+
ri *Dir["src/iowa/**/*.rb"]
|
20
|
+
|
21
|
+
unit_test ["test/TC_DiskCache.rb"]
|
22
|
+
}
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Iowa
|
2
|
+
class Association
|
3
|
+
|
4
|
+
def initialize(association)
|
5
|
+
@association = association
|
6
|
+
end
|
7
|
+
|
8
|
+
def association
|
9
|
+
@association
|
10
|
+
end
|
11
|
+
|
12
|
+
def test(object)
|
13
|
+
true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class PathAssociation < Association
|
18
|
+
def get(object,cache = false,stack_key = C_empty)
|
19
|
+
oca_key = "#{stack_key}/#{@association.hash}"
|
20
|
+
myval = object.cached_associations[oca_key]
|
21
|
+
if cache
|
22
|
+
usecache = myval ? true : false
|
23
|
+
usecache = false if myval.respond_to?(:empty?) and myval.empty?
|
24
|
+
end
|
25
|
+
if cache and usecache
|
26
|
+
myval
|
27
|
+
else
|
28
|
+
object.cached_associations[oca_key] = object.valueForKeyPath(@association)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def set(object, val)
|
33
|
+
object.takeValueForKeyPath(val, @association)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test(object)
|
37
|
+
object.existsKeyPath?(@association)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
class LiteralAssociation < Association
|
42
|
+
|
43
|
+
def get(object = nil, cache = false, stack_key = nil)
|
44
|
+
unless @association.is_a?(Proc)
|
45
|
+
@association
|
46
|
+
else
|
47
|
+
@association.call(object.send(:binding))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def set(object, val)
|
52
|
+
@association = val
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class FlexibleAssociation < Association
|
57
|
+
def FlexibleAssociation.new(association)
|
58
|
+
if association[0] == 123
|
59
|
+
association.sub!(/^\{/,C_empty)
|
60
|
+
association.sub!(/\}\s*$/,C_empty)
|
61
|
+
LiteralAssociation.new(Proc.new {|*ns| ns = ns[0] || binding ; eval(association,ns)})
|
62
|
+
else
|
63
|
+
PathAssociation.new(association)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
require 'iowa/Association'
|
2
|
+
require 'singleton'
|
3
|
+
|
4
|
+
module Iowa
|
5
|
+
|
6
|
+
class UnknownValue
|
7
|
+
include Singleton
|
8
|
+
def to_s
|
9
|
+
'UNK'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
alias :to_str :to_s
|
13
|
+
|
14
|
+
BindingKeywords = {'action' => [LiteralAssociation,true],
|
15
|
+
'id' => [LiteralAssociation, false],
|
16
|
+
'item' => [PathAssociation,true],
|
17
|
+
'list' => [PathAssociation,true],
|
18
|
+
'key' => [PathAssociation,true],
|
19
|
+
'klass' => [LiteralAssociation,true], # not 'class' because of HTML conflict
|
20
|
+
'tag' => [LiteralAssociation,true],
|
21
|
+
'condition' => [PathAssociation,true],
|
22
|
+
'value' => [PathAssociation,true]}
|
23
|
+
|
24
|
+
ClassSeparator = '::'.freeze
|
25
|
+
ContentClassesNamespace = 'Iowa::Application::ContentClasses'.freeze
|
26
|
+
|
27
|
+
C_empty = ''.freeze
|
28
|
+
C_ = ' '.freeze
|
29
|
+
C_anon_ = '_anon_'.freeze
|
30
|
+
C_at = '@'.freeze
|
31
|
+
C_atat = '@@'.freeze
|
32
|
+
C_bnd = '.bnd'.freeze
|
33
|
+
C_content = '_content'.freeze
|
34
|
+
C_default = '_default'.freeze
|
35
|
+
C_dot = '.'.freeze
|
36
|
+
C_dotdot = '..'.freeze
|
37
|
+
C_equal = '='.freeze
|
38
|
+
C_gt = '>'.freeze
|
39
|
+
C_item = '_item'.freeze
|
40
|
+
C_iwa = '.iwa'.freeze
|
41
|
+
C_list = '_list'.freeze
|
42
|
+
C_method = '_method'.freeze
|
43
|
+
C_semicolon = ';'.freeze
|
44
|
+
C_slash = '/'.freeze
|
45
|
+
C0 = '0'.freeze
|
46
|
+
C_0to7 = 0..7.freeze
|
47
|
+
C1 = '1'.freeze
|
48
|
+
Caction = 'action'.freeze
|
49
|
+
Caddresses = 'addresses'.freeze
|
50
|
+
Capplication = 'application'.freeze
|
51
|
+
Capplication_data = 'application/data'.freeze
|
52
|
+
Cbasedir = 'basedir'.freeze
|
53
|
+
Cbaselog = 'baselog'.freeze
|
54
|
+
Cbasename = 'basename'.freeze
|
55
|
+
Cbody = 'body'.freeze
|
56
|
+
CBodyContent = 'BodyContent'.freeze
|
57
|
+
Cbrowsers = 'browsers'.freeze
|
58
|
+
Cbutton = 'button'.freeze
|
59
|
+
Ccacheable = 'cacheable'.freeze
|
60
|
+
Ccheckbox = 'checkbox'.freeze
|
61
|
+
Cchecked = 'checked'.freeze
|
62
|
+
Cchecksum = 'checksum'.freeze
|
63
|
+
CClass = 'Class'.freeze
|
64
|
+
Cclass = 'class'.freeze
|
65
|
+
Ccondition = 'condition'.freeze
|
66
|
+
CContentClasses = 'ContentClasses'.freeze
|
67
|
+
CCookie = 'Cookie'.freeze
|
68
|
+
Ccookie = 'cookie'.freeze
|
69
|
+
Cdaemonize = 'daemonize'.freeze
|
70
|
+
Cdatabase = 'database'.freeze
|
71
|
+
Cdefault = 'default'.freeze
|
72
|
+
Cdepth = 'depth'.freeze
|
73
|
+
Cdirectory = 'directory'.freeze
|
74
|
+
Cdispatcher = 'dispatcher'.freeze
|
75
|
+
Cdoc_root = 'doc_root'.freeze
|
76
|
+
Cdocroot = 'docroot'.freeze
|
77
|
+
CdynamicString = 'dynamicString'.freeze
|
78
|
+
Celement = 'element'.freeze
|
79
|
+
Cexceptions = 'exceptions'.freeze
|
80
|
+
Cfalse = 'false'.freeze
|
81
|
+
CFALSE = 'false'.freeze
|
82
|
+
Cfilename = 'filename'.freeze
|
83
|
+
Cfiles = 'files'.freeze
|
84
|
+
Cforce = 'force'.freeze
|
85
|
+
CEIN = 'EIN'.freeze
|
86
|
+
CHash = 'Hash'.freeze
|
87
|
+
Cheight = 'height'.freeze
|
88
|
+
Chostname = 'hostname'.freeze
|
89
|
+
Chosts = 'hosts'.freeze
|
90
|
+
Chref = 'href'.freeze
|
91
|
+
Cid = 'id'.freeze
|
92
|
+
Cimage = 'image'.freeze
|
93
|
+
Cimage_path = 'image_path'.freeze
|
94
|
+
Cinterval = 'interval'.freeze
|
95
|
+
Ciowa_log = 'iowa_log'.freeze
|
96
|
+
Ciowa_root = 'iowa_root'.freeze
|
97
|
+
Cips = 'ips'.freeze
|
98
|
+
Citem = 'item'.freeze
|
99
|
+
Ckey = 'key'.freeze
|
100
|
+
Cklass = 'klass'.freeze
|
101
|
+
Clabel = 'label'.freeze
|
102
|
+
Clast_modification = 'last_modification'.freeze
|
103
|
+
Clibrary = 'library'.freeze
|
104
|
+
Clink = 'link'.freeze
|
105
|
+
Clist = 'list'.freeze
|
106
|
+
CLocation = 'Location'.freeze
|
107
|
+
Clog_root = 'log_root'.freeze
|
108
|
+
Clogging = 'logging'.freeze
|
109
|
+
Clonely_tag_terminator = ' />'.freeze
|
110
|
+
CMain = 'Main'.freeze
|
111
|
+
Cmapfile = 'mapfile'.freeze
|
112
|
+
Cmaxage = 'maxage'.freeze
|
113
|
+
Cmaxsize = 'maxsize'.freeze
|
114
|
+
Cmethod = 'method'.freeze
|
115
|
+
Cminlevel = 'minlevel'.freeze
|
116
|
+
Cmodel = 'model'.freeze
|
117
|
+
Cmultiple = 'multiple'.freeze
|
118
|
+
Cname = 'name'.freeze
|
119
|
+
COK = 'OK'.freeze
|
120
|
+
Cpage = 'page'.freeze
|
121
|
+
Cpagecache = 'pagecache'.freeze
|
122
|
+
Cparams = 'params'.freeze
|
123
|
+
Cpath = 'path'.freeze
|
124
|
+
Cpolicy = 'policy'.freeze
|
125
|
+
Cport = 'port'.freeze
|
126
|
+
Cplural = 'plural'.freeze
|
127
|
+
Cpost = 'post'.freeze
|
128
|
+
Cradio = 'radio'.freeze
|
129
|
+
Crefresh = 'refresh'.freeze
|
130
|
+
Crequest_cacheable = 'request_cacheable'.freeze
|
131
|
+
Croot_path = 'root_path'.freeze
|
132
|
+
Croot_url = 'root_url'.freeze
|
133
|
+
Cscreens = 'screens'.freeze
|
134
|
+
Cselected = 'selected'.freeze
|
135
|
+
Cserialize_templates = 'serialize_templates'.freeze
|
136
|
+
Csession = 'session'.freeze
|
137
|
+
Csessioncache = 'sessioncache'.freeze
|
138
|
+
Csingular = 'singular'.freeze
|
139
|
+
Csocket = 'socket'.freeze
|
140
|
+
Csrc = 'src'.freeze
|
141
|
+
Csubmit = 'submit'.freeze
|
142
|
+
Ctagclass = 'tagclass'.freeze
|
143
|
+
Ctag = 'tag'.freeze
|
144
|
+
CtemplateRoot = 'templateRoot'.freeze
|
145
|
+
Ctext_html = 'text/html'.freeze
|
146
|
+
Ctext_javascript = 'text/javascript'.freeze
|
147
|
+
Ctitle = 'title'.freeze
|
148
|
+
Ctrue = 'true'.freeze
|
149
|
+
CTRUE = 'TRUE'.freeze
|
150
|
+
Cttl = 'ttl'.freeze
|
151
|
+
Ctype = 'type'.freeze
|
152
|
+
Cuse_lockfile = 'use_lockfile'.freeze
|
153
|
+
CUserAgent = 'User-Agent'.freeze
|
154
|
+
Cvalue = 'value'.freeze
|
155
|
+
Cvariation = 'variation'.freeze
|
156
|
+
Cwebrick = 'webrick'.freeze
|
157
|
+
Cwidth = 'width'.freeze
|
158
|
+
|
159
|
+
end
|
@@ -0,0 +1,377 @@
|
|
1
|
+
require 'thread'
|
2
|
+
require 'iowa/AbstractCache'
|
3
|
+
require 'iowa/Lockfile'
|
4
|
+
require 'digest/sha2'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'find'
|
7
|
+
require 'tmpdir'
|
8
|
+
require 'iowa/LRUCache'
|
9
|
+
|
10
|
+
class Mutex
|
11
|
+
def synchronize_unless(cnd)
|
12
|
+
unless cnd
|
13
|
+
synchronize {yield}
|
14
|
+
else
|
15
|
+
yield
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module Iowa
|
21
|
+
|
22
|
+
# DiskStore is a stripped down version of Iowa::Caches::DiskCache.
|
23
|
+
# DiskStore removes all of the LRU cache trappings, leaving a simple
|
24
|
+
# persistence engine.
|
25
|
+
|
26
|
+
class DiskStore < Iowa::AbstractCache
|
27
|
+
|
28
|
+
DEFAULT_BUCKET_WIDTH = 2
|
29
|
+
DEFAULT_BUCKET_DEPTH = 2
|
30
|
+
|
31
|
+
class NoCacheDir < Exception
|
32
|
+
def initialize(*args)
|
33
|
+
@bad_dir = args[0]
|
34
|
+
end
|
35
|
+
|
36
|
+
def to_s
|
37
|
+
"The cache directory (#{@bad_dir}) does not exist."
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
class DirNotEmpty < Exception
|
42
|
+
def initialize(*args)
|
43
|
+
@bad_dir = args[0]
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_s
|
47
|
+
"The cache directory (#{@bad_dir}) is not empty."
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class DeletedValue
|
52
|
+
attr_accessor :val
|
53
|
+
def initialize(v)
|
54
|
+
@val = v
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def initialize(arg1 = {}, force = nil, width = DEFAULT_BUCKET_WIDTH, depth = DEFAULT_BUCKET_DEPTH, use_lockfile = false)
|
59
|
+
@transaction_cache = []
|
60
|
+
@transaction_lock = [nil,Mutex.new]
|
61
|
+
@cache_dir = nil
|
62
|
+
if arg1.respond_to?(:keys)
|
63
|
+
oargs = arg1
|
64
|
+
arg1 = Iowa::Hash.new
|
65
|
+
arg1.step_merge!(oargs)
|
66
|
+
arg1.stringify_keys!
|
67
|
+
if arg1[Cdirectory]
|
68
|
+
@cache_dir = arg1[Cdirectory]
|
69
|
+
else
|
70
|
+
@cache_dir = File.join(Dir::tmpdir,"tmp#{Time.now.to_f}")
|
71
|
+
FileUtils.mkdir(@cache_dir)
|
72
|
+
end
|
73
|
+
set_cachefile_paths
|
74
|
+
force = arg1[Cforce] || force
|
75
|
+
@bucket_depth = arg1[Cdepth] || depth
|
76
|
+
@bucket_width = arg1[Cwidth] || width
|
77
|
+
@use_lockfile = arg1[Cuse_lockfile] || use_lockfile
|
78
|
+
else
|
79
|
+
@cache_dir = arg1
|
80
|
+
set_cachefile_paths
|
81
|
+
arg1 = {}
|
82
|
+
@bucket_depth = depth
|
83
|
+
@bucket_width = width
|
84
|
+
@use_lockfile = use_lockfile
|
85
|
+
end
|
86
|
+
|
87
|
+
super(arg1)
|
88
|
+
|
89
|
+
@bucket_depth_array = (0..(@bucket_depth - 1)).to_a
|
90
|
+
@locked = false
|
91
|
+
|
92
|
+
unless @use_lockfile
|
93
|
+
@mutex = Mutex.new
|
94
|
+
else
|
95
|
+
@lockfile = Iowa::Lockfile.new(File::join(@cache_dir,'cachelock.lck'))
|
96
|
+
end
|
97
|
+
|
98
|
+
if !FileTest.exist?(@cache_dir)
|
99
|
+
if force
|
100
|
+
FileUtils.mkdir_p(@cache_dir)
|
101
|
+
else
|
102
|
+
raise Iowa::Caches::DiskCache::NoCacheDir.new(@cache_dir)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# Check to see if the cache contains the given key.
|
108
|
+
|
109
|
+
def include?(key)
|
110
|
+
if !@bypass_transactions and transaction_cache_include?(key)
|
111
|
+
if transaction_cache_get(key).is_a?(DeletedValue)
|
112
|
+
false
|
113
|
+
else
|
114
|
+
true
|
115
|
+
end
|
116
|
+
else
|
117
|
+
FileTest.exist?(datafile_for_key(key))
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# Remove a key/value pair from the cache, by key.
|
122
|
+
|
123
|
+
def delete(key)
|
124
|
+
lock_cache do
|
125
|
+
if !@bypass_transactions and transaction_cache_include?(key)
|
126
|
+
tcg = transaction_cache_get(key)
|
127
|
+
unless tcg.is_a?(DeletedValue)
|
128
|
+
@transaction_cache.last[key] = DeletedValue.new(tcg)
|
129
|
+
end
|
130
|
+
elsif FileTest.exist?(datafile_for_key(key))
|
131
|
+
if @transaction_lock[0] and @transaction_cache.length > 0
|
132
|
+
@transaction_cache.last[key] = DeletedValue.new(self[key])
|
133
|
+
else
|
134
|
+
File::unlink(datafile_for_key(key))
|
135
|
+
|
136
|
+
#new_count = getdata(@cache_count,false) - 1
|
137
|
+
#putdata(new_count,@cache_count)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# Return the element identified by the given key.
|
144
|
+
|
145
|
+
def [](key)
|
146
|
+
r = nil
|
147
|
+
lock_cache do
|
148
|
+
if !@bypass_transactions and transaction_cache_include?(key)
|
149
|
+
transaction_cache_get(key)
|
150
|
+
else
|
151
|
+
datafile = datafile_for_key(key)
|
152
|
+
if FileTest.exist?(datafile)
|
153
|
+
FileUtils::touch(datafile)
|
154
|
+
r = getdata(datafile,false)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
r
|
159
|
+
end
|
160
|
+
|
161
|
+
def prune
|
162
|
+
tail = getdata(@cache_tail)
|
163
|
+
delete(getdata(File.join(path_for_hash(tail),"#{tail}.key"))) if tail
|
164
|
+
end
|
165
|
+
|
166
|
+
def attach(key, val)
|
167
|
+
lock_cache do
|
168
|
+
already_in_cache = include?(key)
|
169
|
+
|
170
|
+
#putdata((getdata(@cache_count) + 1),@cache_count,false) unless already_in_cache
|
171
|
+
# Write the data file.
|
172
|
+
putdata(val,datafile_for_key(key))
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
# Set the element of the cache identified by the given key.
|
177
|
+
|
178
|
+
def []=(key, val)
|
179
|
+
lock_cache do
|
180
|
+
if !@bypass_transactions and @transaction_cache.length > 0
|
181
|
+
@transaction_cache.last[key] = val
|
182
|
+
else
|
183
|
+
attach(key, val)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
# Allows one to set the maximum size of the cache queue. If the queue
|
189
|
+
# is currently larger than the size that it is being set to, elements
|
190
|
+
# will be expired until the queue is at the maximum size.
|
191
|
+
|
192
|
+
def size=(max)
|
193
|
+
end
|
194
|
+
alias maxsize= size=
|
195
|
+
|
196
|
+
# Return the maximum size of the cache.
|
197
|
+
def maxsize
|
198
|
+
end
|
199
|
+
|
200
|
+
# Return the current size of the cache.
|
201
|
+
def size
|
202
|
+
#getdata(@cache_count)
|
203
|
+
end
|
204
|
+
|
205
|
+
def ttl=(newttl)
|
206
|
+
end
|
207
|
+
alias maxttl= ttl=
|
208
|
+
|
209
|
+
def ttl
|
210
|
+
getdata(@maxttl)
|
211
|
+
end
|
212
|
+
|
213
|
+
# Return a copy of current set of keys to cache elements.
|
214
|
+
def queue
|
215
|
+
r = []
|
216
|
+
Find::find(@cache_dir) do |p|
|
217
|
+
if p =~ /#{File::SEPARATOR}[^#{File::SEPARATOR}]+.key$/
|
218
|
+
r.push getdata(p)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
r
|
222
|
+
end
|
223
|
+
|
224
|
+
def transaction(&b)
|
225
|
+
Thread.critical = true
|
226
|
+
if @transaction_lock[0] and @transaction_cache.length > 0
|
227
|
+
if Thread.current == @transaction_lock[0]
|
228
|
+
Thread.critical = false
|
229
|
+
inner_transaction(b)
|
230
|
+
return true
|
231
|
+
end
|
232
|
+
else
|
233
|
+
@transaction_lock[0] = Thread.current
|
234
|
+
end
|
235
|
+
Thread.critical = false
|
236
|
+
@transaction_lock[1].synchronize {inner_transaction(b)}
|
237
|
+
@transaction_lock[0] = nil
|
238
|
+
end
|
239
|
+
|
240
|
+
def commit(final = false)
|
241
|
+
Thread.critical = true
|
242
|
+
transactions = @transaction_cache.pop
|
243
|
+
q = transactions.queue
|
244
|
+
(q.length - 1).downto(0) do |x|
|
245
|
+
k = q[x]
|
246
|
+
v = transactions[k]
|
247
|
+
if v.is_a?(DeletedValue)
|
248
|
+
@bypass_transactions = true
|
249
|
+
self.delete(k)
|
250
|
+
@bypass_transactions = false
|
251
|
+
else
|
252
|
+
@bypass_transactions = true
|
253
|
+
self[k] = transactions[k]
|
254
|
+
@bypass_transactions = false
|
255
|
+
end
|
256
|
+
end
|
257
|
+
unless final
|
258
|
+
@transaction_cache.push Iowa::Caches::LRUCache.new({:maxsize => 4294967296})
|
259
|
+
end
|
260
|
+
Thread.critical = false
|
261
|
+
end
|
262
|
+
|
263
|
+
def rollback
|
264
|
+
Thread.critical = true
|
265
|
+
@transaction_cache.pop
|
266
|
+
@transaction_cache.push Iowa::Caches::LRUCache.new({:maxsize => 4294967296})
|
267
|
+
Thread.critical = true
|
268
|
+
end
|
269
|
+
|
270
|
+
private
|
271
|
+
|
272
|
+
def inner_transaction(blk)
|
273
|
+
@transaction_cache.push Iowa::Caches::LRUCache.new({:maxsize => 4294967296})
|
274
|
+
blk.call
|
275
|
+
Thread.critical = true
|
276
|
+
commit(true)
|
277
|
+
Thread.critical = false
|
278
|
+
end
|
279
|
+
|
280
|
+
def transaction_cache_include?(key)
|
281
|
+
@transaction_cache.each do |tc|
|
282
|
+
return true if tc.include? key
|
283
|
+
end
|
284
|
+
false
|
285
|
+
end
|
286
|
+
|
287
|
+
def transaction_cache_get(key)
|
288
|
+
(@transaction_cache.length - 1).downto(0) do |x|
|
289
|
+
return @transaction_cache[x][key] if @transaction_cache[x].include?(key)
|
290
|
+
end
|
291
|
+
nil
|
292
|
+
end
|
293
|
+
|
294
|
+
def lock_cache
|
295
|
+
Thread.critical = true
|
296
|
+
transaction_in_progress = (@transaction_lock[0] and @transaction_cache.length > 0) ? true : false
|
297
|
+
@transaction_lock[0] = Thread.current unless transaction_in_progress
|
298
|
+
Thread.critical = false if transaction_in_progress
|
299
|
+
@transaction_lock[1].synchronize_unless(@transaction_lock[0] == Thread.current) do
|
300
|
+
Thread.critical = false unless transaction_in_progress
|
301
|
+
unless @locked
|
302
|
+
begin
|
303
|
+
if @use_lockfile
|
304
|
+
@lockfile.lock {@locked = true; yield}
|
305
|
+
else
|
306
|
+
@mutex.synchronize {@locked = true; yield}
|
307
|
+
end
|
308
|
+
ensure
|
309
|
+
@locked = false
|
310
|
+
end
|
311
|
+
else
|
312
|
+
yield
|
313
|
+
end
|
314
|
+
end
|
315
|
+
@transaction_lock[0] = nil unless transaction_in_progress
|
316
|
+
end
|
317
|
+
|
318
|
+
def hash_for_key(key)
|
319
|
+
Digest::SHA512.hexdigest(Marshal.dump(key))
|
320
|
+
end
|
321
|
+
|
322
|
+
def path_for_hash(hash)
|
323
|
+
# Take the hash key and break it apart by bucket_depth and bucket_width
|
324
|
+
# to return the path to the directory that should contain the
|
325
|
+
# cache element.
|
326
|
+
File.join(@cache_dir,@bucket_depth_array.collect {|d| hash[(d * @bucket_width),@bucket_width]})
|
327
|
+
end
|
328
|
+
|
329
|
+
def datafile_for_key(key)
|
330
|
+
h = hash_for_key(key)
|
331
|
+
File.join(path_for_hash(h),"#{h}.dat")
|
332
|
+
end
|
333
|
+
|
334
|
+
def getdata(filename,do_lock = true)
|
335
|
+
r = nil
|
336
|
+
if do_lock
|
337
|
+
lock_cache do
|
338
|
+
if FileTest::exist?(filename)
|
339
|
+
File.open(filename) {|fh| r = Marshal.load(fh)}
|
340
|
+
end
|
341
|
+
end
|
342
|
+
else
|
343
|
+
if FileTest::exist?(filename)
|
344
|
+
File.open(filename) {|fh| r = Marshal.load(fh)}
|
345
|
+
end
|
346
|
+
end
|
347
|
+
r
|
348
|
+
end
|
349
|
+
|
350
|
+
def getdata_worker(filename)
|
351
|
+
if FileTest::exist?(filename)
|
352
|
+
File.open(filename) {|fh| Marshal.load(fh)}
|
353
|
+
else
|
354
|
+
nil
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
def putdata(value,filename,do_lock = true)
|
359
|
+
if do_lock
|
360
|
+
lock_cache do
|
361
|
+
putdata_worker(value,filename)
|
362
|
+
end
|
363
|
+
else
|
364
|
+
putdata_worker(value,filename)
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
368
|
+
def putdata_worker(value,filename)
|
369
|
+
FileUtils.mkdir_p(File::dirname(filename)) unless FileTest.exist?(File::dirname(filename))
|
370
|
+
File.open(filename,'w') {|fh| Marshal.dump(value,fh)}
|
371
|
+
end
|
372
|
+
|
373
|
+
def set_cachefile_paths
|
374
|
+
#@cache_count = File.join(@cache_dir,'cache_count.inf')
|
375
|
+
end
|
376
|
+
end
|
377
|
+
end
|