Datapack Stream Wrapper Commited!

Written on October 9, 2008 by Mike Gerwitz

FINALLY! It feels so good to finally commit the wrapper to SVN. It was pretty annoying to get working - it is perhaps the most complicated script I have had to work on. It took a lot of planning and rewrites - it was a learn-as-you-go thing for me. Thankfully, this rewrite is fairly good and fast.

Included with the wrapper is a test script: tools/tests/datapack.php. This script will test most aspects of the system and help demonstrate the speeds. Run the script a few times to get a good idea of the average speeds. The first run may take a bit to complete, depending on the speed of your system and your server load - 10-30 seconds, probably. After that, the random date generated is cached and the script should run, hopefully, in under a few seconds.

Unfortunatly,the wrapper is not yet complete - but it is operational and usable. The todo list is included in the file header and is as follows:

  1.  Verify written data by checking bytes written rather than FALSE
  2. Support multiple keypack file operations (multiple opens)
  3. Cache next fragment position within previous descriptor (maybe…it’d speed up read times but slow writes, so perhaps we could have the OPTION to do this…)
  4. Wait for lock rather than return error (unless timeout)
  5. 0×03 mark fragments as empty for other blocks to use?
  6. Use constants for $block_frags indexes…less confusing and less trouble should we decide to modify it later
  7. After working on this for so long, I want to get to work on other things; so more performance optimization can wait. But, optimize.
  8. Negative seeks are not yet supported
  9. “r+” mode is not yet properly implemented
  10. When appending, system seeks to last fragment by default; it does not check for available space in previous fragments
  11. get_frag_bytes may report more bytes than the file contains - why?
  12. convert() is a little messy; maybe add a function to switch between blocks?
  13. Check for free space before converting/defragmenting
  14. You receive no warning if you’re writing to an already opened keypack

If you have any free time on your hands and feel like trying to fix any of those, go right ahead :)

So..there you have it. I’ll be posting a link to the generated documentation and hopefully begin working on the language system tonight.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>