====================
The `fstail` utility
====================

The `fstail` utility shows information for a FileStorage about the last `n`
transactions:

We have to prepare a FileStorage first:

  >>> from ZODB.FileStorage import FileStorage
  >>> from ZODB.DB import DB
  >>> import transaction
  >>> from tempfile import mktemp
  >>> storagefile = mktemp(suffix='.fs')
  >>> base_storage = FileStorage(storagefile)
  >>> database = DB(base_storage)
  >>> connection1 = database.open()
  >>> root = connection1.root()
  >>> root['foo'] = 1
  >>> transaction.commit()

Now lets have a look at the last transactions of this FileStorage:

  >>> from ZODB.scripts.fstail import main
  >>> main(storagefile, 5)
  2007-11-10 15:18:48.543001: hash=b16422d09fabdb45d4e4325e4b42d7d6f021d3c3
  user='' description='' length=132 offset=162 (+23)
  <BLANKLINE>
  2007-11-10 15:18:48.543001: hash=b16422d09fabdb45d4e4325e4b42d7d6f021d3c3
  user='' description='initial database creation' length=150 offset=4 (+48)
  <BLANKLINE>

Now clean up the storage again:

  >>> import os
  >>> connection1.close()
  >>> base_storage.close()
  >>> os.unlink(storagefile)
  >>> os.unlink(storagefile+'.index')
  >>> os.unlink(storagefile+'.lock')
  >>> os.unlink(storagefile+'.tmp')
