2011-06-23 20:47:51 +00:00
|
|
|
from __future__ import with_statement
|
2010-12-04 20:03:02 +00:00
|
|
|
from ConfigParser import RawConfigParser
|
2011-06-18 09:26:20 +00:00
|
|
|
import errno
|
2010-12-04 20:03:02 +00:00
|
|
|
import fcntl
|
2010-05-26 19:41:55 +00:00
|
|
|
import os
|
|
|
|
import shutil
|
2010-12-04 20:03:02 +00:00
|
|
|
import struct
|
|
|
|
import tempfile
|
2010-05-26 19:41:55 +00:00
|
|
|
import unittest
|
2010-12-17 21:13:10 +00:00
|
|
|
from zlib import crc32
|
2010-05-26 19:41:55 +00:00
|
|
|
|
2010-12-08 21:57:26 +00:00
|
|
|
from .hashindex import NSIndex, BandIndex
|
2011-07-17 20:31:37 +00:00
|
|
|
from .helpers import IntegrityError, read_set, write_set, deferrable
|
2010-12-17 21:13:10 +00:00
|
|
|
from .lrucache import LRUCache
|
2010-10-19 19:08:42 +00:00
|
|
|
|
2010-05-26 19:41:55 +00:00
|
|
|
|
2010-10-26 19:25:25 +00:00
|
|
|
class Store(object):
|
2010-12-04 20:03:02 +00:00
|
|
|
"""Filesystem based transactional key value store
|
|
|
|
|
|
|
|
On disk layout:
|
|
|
|
dir/README
|
|
|
|
dir/config
|
|
|
|
dir/bands/<X / BANDS_PER_DIR>/<X>
|
|
|
|
dir/indexes/<NS>
|
2010-05-26 19:41:55 +00:00
|
|
|
"""
|
2010-12-08 21:57:26 +00:00
|
|
|
DEFAULT_MAX_BAND_SIZE = 5 * 1024 * 1024
|
2010-12-04 20:03:02 +00:00
|
|
|
DEFAULT_BANDS_PER_DIR = 10000
|
2010-05-26 19:41:55 +00:00
|
|
|
|
|
|
|
class DoesNotExist(KeyError):
|
2010-12-04 20:03:02 +00:00
|
|
|
"""Requested key does not exist"""
|
2010-05-26 19:41:55 +00:00
|
|
|
|
|
|
|
|
2010-10-26 19:48:43 +00:00
|
|
|
def __init__(self, path, create=False):
|
2010-12-04 20:03:02 +00:00
|
|
|
self.txn_active = False
|
2011-07-30 19:13:48 +00:00
|
|
|
if create:
|
2010-05-26 19:41:55 +00:00
|
|
|
self.create(path)
|
2010-10-15 17:56:38 +00:00
|
|
|
self.open(path)
|
|
|
|
|
2010-05-26 19:41:55 +00:00
|
|
|
def create(self, path):
|
2010-12-04 20:03:02 +00:00
|
|
|
"""Create a new empty store at `path`
|
|
|
|
"""
|
2010-10-26 19:48:43 +00:00
|
|
|
if os.path.exists(path) and (not os.path.isdir(path) or os.listdir(path)):
|
|
|
|
raise Exception('Path "%s" already exists' % path)
|
|
|
|
if not os.path.exists(path):
|
|
|
|
os.mkdir(path)
|
2010-12-04 20:03:02 +00:00
|
|
|
with open(os.path.join(path, 'README'), 'wb') as fd:
|
|
|
|
fd.write('This is a DARC store')
|
2010-05-26 19:41:55 +00:00
|
|
|
os.mkdir(os.path.join(path, 'bands'))
|
2010-12-04 20:03:02 +00:00
|
|
|
os.mkdir(os.path.join(path, 'indexes'))
|
|
|
|
config = RawConfigParser()
|
|
|
|
config.add_section('store')
|
|
|
|
config.set('store', 'version', '1')
|
|
|
|
config.set('store', 'id', os.urandom(32).encode('hex'))
|
|
|
|
config.set('store', 'bands_per_dir', self.DEFAULT_BANDS_PER_DIR)
|
|
|
|
config.set('store', 'max_band_size', self.DEFAULT_MAX_BAND_SIZE)
|
|
|
|
config.add_section('state')
|
|
|
|
config.set('state', 'next_band', '0')
|
|
|
|
config.set('state', 'tid', '0')
|
|
|
|
with open(os.path.join(path, 'config'), 'w') as fd:
|
|
|
|
config.write(fd)
|
|
|
|
|
|
|
|
def open(self, path):
|
|
|
|
self.path = path
|
|
|
|
if not os.path.isdir(path):
|
|
|
|
raise Exception('%s Does not look like a darc store' % path)
|
|
|
|
self.lock_fd = open(os.path.join(path, 'README'), 'r+')
|
|
|
|
fcntl.flock(self.lock_fd, fcntl.LOCK_EX)
|
2010-12-21 20:29:09 +00:00
|
|
|
self.rollback()
|
2010-12-04 20:03:02 +00:00
|
|
|
self.config = RawConfigParser()
|
|
|
|
self.config.read(os.path.join(path, 'config'))
|
|
|
|
if self.config.getint('store', 'version') != 1:
|
|
|
|
raise Exception('%s Does not look like a darc store')
|
2010-12-06 20:46:29 +00:00
|
|
|
self.id = self.config.get('store', 'id').decode('hex')
|
2010-12-04 20:03:02 +00:00
|
|
|
self.tid = self.config.getint('state', 'tid')
|
|
|
|
next_band = self.config.getint('state', 'next_band')
|
|
|
|
max_band_size = self.config.getint('store', 'max_band_size')
|
|
|
|
bands_per_dir = self.config.getint('store', 'bands_per_dir')
|
|
|
|
self.io = BandIO(self.path, next_band, max_band_size, bands_per_dir)
|
2011-06-18 09:26:20 +00:00
|
|
|
self.io.cleanup()
|
2010-12-04 20:03:02 +00:00
|
|
|
|
2010-12-19 11:46:42 +00:00
|
|
|
def delete_bands(self):
|
|
|
|
delete_path = os.path.join(self.path, 'indexes', 'delete')
|
|
|
|
if os.path.exists(delete_path):
|
2011-06-18 09:26:20 +00:00
|
|
|
bands = self.get_index('bands')
|
2010-12-19 11:46:42 +00:00
|
|
|
for band in read_set(delete_path):
|
2011-06-18 09:26:20 +00:00
|
|
|
assert bands.pop(band, 0) == 0
|
|
|
|
self.io.delete_band(band, missing_ok=True)
|
2010-12-19 11:46:42 +00:00
|
|
|
os.unlink(delete_path)
|
|
|
|
|
2010-12-04 20:03:02 +00:00
|
|
|
def begin_txn(self):
|
|
|
|
txn_dir = os.path.join(self.path, 'txn.tmp')
|
|
|
|
# Initialize transaction snapshot
|
|
|
|
os.mkdir(txn_dir)
|
|
|
|
shutil.copytree(os.path.join(self.path, 'indexes'),
|
|
|
|
os.path.join(txn_dir, 'indexes'))
|
|
|
|
shutil.copy(os.path.join(self.path, 'config'), txn_dir)
|
|
|
|
os.rename(os.path.join(self.path, 'txn.tmp'),
|
|
|
|
os.path.join(self.path, 'txn.active'))
|
|
|
|
self.compact = set()
|
|
|
|
self.txn_active = True
|
2010-05-26 19:41:55 +00:00
|
|
|
|
|
|
|
def close(self):
|
2010-10-17 20:04:50 +00:00
|
|
|
self.rollback()
|
2010-10-15 17:56:38 +00:00
|
|
|
self.lock_fd.close()
|
2010-05-26 19:41:55 +00:00
|
|
|
|
|
|
|
def commit(self):
|
2010-12-04 20:03:02 +00:00
|
|
|
"""Commit transaction, `tid` will be increased by 1
|
2010-05-26 19:41:55 +00:00
|
|
|
"""
|
2010-12-04 20:03:02 +00:00
|
|
|
self.compact_bands()
|
|
|
|
self.io.close()
|
2010-10-18 22:00:52 +00:00
|
|
|
self.tid += 1
|
2010-12-04 20:03:02 +00:00
|
|
|
self.config.set('state', 'tid', self.tid)
|
|
|
|
self.config.set('state', 'next_band', self.io.band + 1)
|
|
|
|
with open(os.path.join(self.path, 'config'), 'w') as fd:
|
|
|
|
self.config.write(fd)
|
|
|
|
for i in self.indexes.values():
|
|
|
|
i.flush()
|
2011-06-18 09:26:20 +00:00
|
|
|
# If we crash before this line, the transaction will be
|
|
|
|
# rolled back by open()
|
2010-12-04 20:03:02 +00:00
|
|
|
os.rename(os.path.join(self.path, 'txn.active'),
|
2011-06-18 09:26:20 +00:00
|
|
|
os.path.join(self.path, 'txn.commit'))
|
|
|
|
self.rollback()
|
2010-12-04 20:03:02 +00:00
|
|
|
|
|
|
|
def compact_bands(self):
|
2010-12-19 11:46:42 +00:00
|
|
|
"""Compact sparse bands by copying data into new bands
|
|
|
|
"""
|
2010-12-04 20:03:02 +00:00
|
|
|
if not self.compact:
|
|
|
|
return
|
|
|
|
self.io.close_band()
|
2010-12-07 20:45:21 +00:00
|
|
|
def lookup(ns, key):
|
2010-12-21 20:29:09 +00:00
|
|
|
return key in self.get_index(ns)
|
2011-06-18 09:26:20 +00:00
|
|
|
bands = self.get_index('bands')
|
2010-12-04 20:03:02 +00:00
|
|
|
for band in self.compact:
|
2011-06-18 09:26:20 +00:00
|
|
|
if bands[band] > 0:
|
2010-12-08 21:57:26 +00:00
|
|
|
for ns, key, data in self.io.iter_objects(band, lookup):
|
|
|
|
new_band, offset = self.io.write(ns, key, data)
|
|
|
|
self.indexes[ns][key] = new_band, offset
|
2011-06-18 09:26:20 +00:00
|
|
|
bands[band] -= 1
|
|
|
|
bands.setdefault(new_band, 0)
|
|
|
|
bands[new_band] += 1
|
2010-12-19 11:46:42 +00:00
|
|
|
write_set(self.compact, os.path.join(self.path, 'indexes', 'delete'))
|
2010-05-26 19:41:55 +00:00
|
|
|
|
|
|
|
def rollback(self):
|
|
|
|
"""
|
|
|
|
"""
|
2011-06-18 09:26:20 +00:00
|
|
|
# Commit any half committed transaction
|
|
|
|
if os.path.exists(os.path.join(self.path, 'txn.commit')):
|
|
|
|
self.delete_bands()
|
|
|
|
os.rename(os.path.join(self.path, 'txn.commit'),
|
|
|
|
os.path.join(self.path, 'txn.tmp'))
|
2010-12-04 20:03:02 +00:00
|
|
|
# Roll back active transaction
|
|
|
|
txn_dir = os.path.join(self.path, 'txn.active')
|
|
|
|
if os.path.exists(txn_dir):
|
|
|
|
shutil.rmtree(os.path.join(self.path, 'indexes'))
|
|
|
|
shutil.copytree(os.path.join(txn_dir, 'indexes'),
|
|
|
|
os.path.join(self.path, 'indexes'))
|
|
|
|
shutil.copy(os.path.join(txn_dir, 'config'), self.path)
|
2011-06-18 09:26:20 +00:00
|
|
|
os.rename(txn_dir, os.path.join(self.path, 'txn.tmp'))
|
|
|
|
# Remove partially removed transaction
|
|
|
|
if os.path.exists(os.path.join(self.path, 'txn.tmp')):
|
|
|
|
shutil.rmtree(os.path.join(self.path, 'txn.tmp'))
|
2010-12-04 20:03:02 +00:00
|
|
|
self.indexes = {}
|
|
|
|
self.txn_active = False
|
|
|
|
|
|
|
|
def get_index(self, ns):
|
|
|
|
try:
|
|
|
|
return self.indexes[ns]
|
|
|
|
except KeyError:
|
2011-06-18 09:26:20 +00:00
|
|
|
if ns == 'bands':
|
|
|
|
filename = os.path.join(self.path, 'indexes', 'bands')
|
|
|
|
cls = BandIndex
|
|
|
|
else:
|
|
|
|
filename = os.path.join(self.path, 'indexes', 'ns%d' % ns)
|
|
|
|
cls = NSIndex
|
2010-12-04 20:03:02 +00:00
|
|
|
if os.path.exists(filename):
|
2011-06-18 09:26:20 +00:00
|
|
|
self.indexes[ns] = cls(filename)
|
2010-12-04 20:03:02 +00:00
|
|
|
else:
|
2011-06-18 09:26:20 +00:00
|
|
|
self.indexes[ns] = cls.create(filename)
|
2010-12-04 20:03:02 +00:00
|
|
|
return self.indexes[ns]
|
2010-05-26 19:41:55 +00:00
|
|
|
|
2011-07-17 20:31:37 +00:00
|
|
|
@deferrable
|
2010-05-26 19:41:55 +00:00
|
|
|
def get(self, ns, id):
|
2010-12-04 20:03:02 +00:00
|
|
|
try:
|
|
|
|
band, offset = self.get_index(ns)[id]
|
2011-07-02 18:14:45 +00:00
|
|
|
return self.io.read(band, offset, ns, id)
|
2010-12-04 20:03:02 +00:00
|
|
|
except KeyError:
|
2010-05-26 19:41:55 +00:00
|
|
|
raise self.DoesNotExist
|
|
|
|
|
2011-07-17 20:31:37 +00:00
|
|
|
@deferrable
|
2010-05-26 19:41:55 +00:00
|
|
|
def put(self, ns, id, data):
|
2010-12-04 20:03:02 +00:00
|
|
|
if not self.txn_active:
|
|
|
|
self.begin_txn()
|
|
|
|
band, offset = self.io.write(ns, id, data)
|
2011-06-18 09:26:20 +00:00
|
|
|
bands = self.get_index('bands')
|
|
|
|
bands.setdefault(band, 0)
|
|
|
|
bands[band] += 1
|
2010-12-04 20:03:02 +00:00
|
|
|
self.get_index(ns)[id] = band, offset
|
2010-05-26 19:41:55 +00:00
|
|
|
|
2011-07-17 20:31:37 +00:00
|
|
|
@deferrable
|
2010-05-26 19:41:55 +00:00
|
|
|
def delete(self, ns, id):
|
2010-12-04 20:03:02 +00:00
|
|
|
if not self.txn_active:
|
|
|
|
self.begin_txn()
|
|
|
|
try:
|
|
|
|
band, offset = self.get_index(ns).pop(id)
|
2011-06-18 09:26:20 +00:00
|
|
|
self.get_index('bands')[band] -= 1
|
2010-12-04 20:03:02 +00:00
|
|
|
self.compact.add(band)
|
|
|
|
except KeyError:
|
2010-05-26 19:41:55 +00:00
|
|
|
raise self.DoesNotExist
|
|
|
|
|
2011-07-17 20:31:37 +00:00
|
|
|
@deferrable
|
2010-12-04 20:03:02 +00:00
|
|
|
def list(self, ns, marker=None, limit=1000000):
|
2011-07-05 19:29:15 +00:00
|
|
|
return [key for key, value in self.get_index(ns).iteritems(marker=marker, limit=limit)]
|
2010-12-04 20:03:02 +00:00
|
|
|
|
2011-07-17 21:53:23 +00:00
|
|
|
def flush_rpc(self):
|
|
|
|
pass
|
|
|
|
|
2010-12-04 20:03:02 +00:00
|
|
|
|
|
|
|
class BandIO(object):
|
|
|
|
|
2011-06-23 20:47:51 +00:00
|
|
|
header_fmt = struct.Struct('<IBIB32s')
|
2010-12-17 21:13:10 +00:00
|
|
|
assert header_fmt.size == 42
|
2010-12-04 20:03:02 +00:00
|
|
|
|
|
|
|
def __init__(self, path, nextband, limit, bands_per_dir, capacity=100):
|
|
|
|
self.path = path
|
|
|
|
self.fds = LRUCache(capacity)
|
|
|
|
self.band = nextband
|
|
|
|
self.limit = limit
|
|
|
|
self.bands_per_dir = bands_per_dir
|
|
|
|
self.offset = 0
|
|
|
|
|
|
|
|
def close(self):
|
|
|
|
for band in self.fds.keys():
|
|
|
|
self.fds.pop(band).close()
|
|
|
|
|
2010-12-19 11:46:42 +00:00
|
|
|
def cleanup(self):
|
|
|
|
"""Delete band files left by aborted transactions
|
|
|
|
"""
|
|
|
|
band = self.band
|
|
|
|
while True:
|
|
|
|
filename = self.band_filename(band)
|
|
|
|
if not os.path.exists(filename):
|
|
|
|
break
|
|
|
|
os.unlink(filename)
|
|
|
|
band += 1
|
|
|
|
|
2010-12-04 20:03:02 +00:00
|
|
|
def band_filename(self, band):
|
|
|
|
return os.path.join(self.path, 'bands', str(band / self.bands_per_dir), str(band))
|
|
|
|
|
|
|
|
def get_fd(self, band, write=False):
|
|
|
|
try:
|
|
|
|
return self.fds[band]
|
|
|
|
except KeyError:
|
|
|
|
if write and band % 1000 == 0:
|
|
|
|
dirname = os.path.join(self.path, 'bands', str(band / self.bands_per_dir))
|
|
|
|
if not os.path.exists(dirname):
|
|
|
|
os.mkdir(dirname)
|
|
|
|
fd = open(self.band_filename(band), write and 'w+' or 'rb')
|
|
|
|
self.fds[band] = fd
|
|
|
|
return fd
|
|
|
|
|
2011-06-18 09:26:20 +00:00
|
|
|
def delete_band(self, band, missing_ok=False):
|
|
|
|
try:
|
|
|
|
os.unlink(self.band_filename(band))
|
|
|
|
except OSError, e:
|
|
|
|
if not missing_ok or e.errno != errno.ENOENT:
|
|
|
|
raise
|
2010-12-04 20:03:02 +00:00
|
|
|
|
2011-07-02 18:14:45 +00:00
|
|
|
def read(self, band, offset, ns, id):
|
2010-12-04 20:03:02 +00:00
|
|
|
fd = self.get_fd(band)
|
|
|
|
fd.seek(offset)
|
|
|
|
data = fd.read(self.header_fmt.size)
|
2011-07-02 18:14:45 +00:00
|
|
|
size, magic, hash, ns_, id_ = self.header_fmt.unpack(data)
|
2010-12-06 20:46:29 +00:00
|
|
|
assert magic == 0
|
2011-07-02 18:14:45 +00:00
|
|
|
assert ns == ns_
|
|
|
|
assert id == id_
|
2010-12-17 21:13:10 +00:00
|
|
|
data = fd.read(size - self.header_fmt.size)
|
2011-06-23 20:47:51 +00:00
|
|
|
if crc32(data) & 0xffffffff != hash:
|
2010-12-17 21:13:10 +00:00
|
|
|
raise IntegrityError('Band checksum mismatch')
|
|
|
|
return data
|
2010-12-04 20:03:02 +00:00
|
|
|
|
2010-12-07 20:45:21 +00:00
|
|
|
def iter_objects(self, band, lookup):
|
2010-12-04 20:03:02 +00:00
|
|
|
fd = self.get_fd(band)
|
|
|
|
fd.seek(0)
|
|
|
|
assert fd.read(8) == 'DARCBAND'
|
|
|
|
offset = 8
|
|
|
|
data = fd.read(self.header_fmt.size)
|
|
|
|
while data:
|
2010-12-17 21:13:10 +00:00
|
|
|
size, magic, hash, ns, key = self.header_fmt.unpack(data)
|
|
|
|
assert magic == 0
|
2010-12-07 20:45:21 +00:00
|
|
|
offset += size
|
|
|
|
if lookup(ns, key):
|
2010-12-17 21:13:10 +00:00
|
|
|
data = fd.read(size - self.header_fmt.size)
|
2011-06-23 20:47:51 +00:00
|
|
|
if crc32(data) & 0xffffffff != hash:
|
2010-12-17 21:13:10 +00:00
|
|
|
raise IntegrityError('Band checksum mismatch')
|
|
|
|
yield ns, key, data
|
2010-12-07 20:45:21 +00:00
|
|
|
else:
|
|
|
|
fd.seek(offset)
|
2010-12-04 20:03:02 +00:00
|
|
|
data = fd.read(self.header_fmt.size)
|
|
|
|
|
|
|
|
def write(self, ns, id, data):
|
|
|
|
size = len(data) + self.header_fmt.size
|
|
|
|
if self.offset and self.offset + size > self.limit:
|
|
|
|
self.close_band()
|
|
|
|
fd = self.get_fd(self.band, write=True)
|
|
|
|
fd.seek(self.offset)
|
|
|
|
if self.offset == 0:
|
|
|
|
fd.write('DARCBAND')
|
|
|
|
self.offset = 8
|
|
|
|
offset = self.offset
|
2011-06-23 20:47:51 +00:00
|
|
|
hash = crc32(data) & 0xffffffff
|
2010-12-17 21:13:10 +00:00
|
|
|
fd.write(self.header_fmt.pack(size, 0, hash, ns, id))
|
2010-12-04 20:03:02 +00:00
|
|
|
fd.write(data)
|
|
|
|
self.offset += size
|
|
|
|
return self.band, offset
|
|
|
|
|
|
|
|
def close_band(self):
|
|
|
|
self.band += 1
|
|
|
|
self.offset = 0
|
2010-05-26 19:41:55 +00:00
|
|
|
|
|
|
|
|
2010-10-26 19:25:25 +00:00
|
|
|
class StoreTestCase(unittest.TestCase):
|
2010-05-26 19:41:55 +00:00
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
self.tmppath = tempfile.mkdtemp()
|
2010-10-26 19:48:43 +00:00
|
|
|
self.store = Store(os.path.join(self.tmppath, 'store'), create=True)
|
2010-05-26 19:41:55 +00:00
|
|
|
|
|
|
|
def tearDown(self):
|
|
|
|
shutil.rmtree(self.tmppath)
|
|
|
|
|
|
|
|
def test1(self):
|
|
|
|
self.assertEqual(self.store.tid, 0)
|
2010-12-04 20:03:02 +00:00
|
|
|
for x in range(100):
|
|
|
|
self.store.put(0, '%-32d' % x, 'SOMEDATA')
|
|
|
|
key50 = '%-32d' % 50
|
|
|
|
self.assertEqual(self.store.get(0, key50), 'SOMEDATA')
|
|
|
|
self.store.delete(0, key50)
|
|
|
|
self.assertRaises(self.store.DoesNotExist, lambda: self.store.get(0, key50))
|
2010-05-26 19:41:55 +00:00
|
|
|
self.store.commit()
|
|
|
|
self.assertEqual(self.store.tid, 1)
|
2010-12-04 20:03:02 +00:00
|
|
|
self.store.close()
|
|
|
|
store2 = Store(os.path.join(self.tmppath, 'store'))
|
|
|
|
self.assertEqual(store2.tid, 1)
|
2011-07-02 18:39:22 +00:00
|
|
|
keys = list(store2.list(0))
|
2010-12-04 20:03:02 +00:00
|
|
|
for x in range(50):
|
|
|
|
key = '%-32d' % x
|
|
|
|
self.assertEqual(store2.get(0, key), 'SOMEDATA')
|
|
|
|
self.assertRaises(store2.DoesNotExist, lambda: store2.get(0, key50))
|
|
|
|
assert key50 not in keys
|
|
|
|
for x in range(51, 100):
|
|
|
|
key = '%-32d' % x
|
|
|
|
assert key in keys
|
|
|
|
self.assertEqual(store2.get(0, key), 'SOMEDATA')
|
|
|
|
self.assertEqual(len(keys), 99)
|
|
|
|
for x in range(50):
|
|
|
|
key = '%-32d' % x
|
|
|
|
store2.delete(0, key)
|
2011-07-02 18:39:22 +00:00
|
|
|
self.assertEqual(len(list(store2.list(0))), 49)
|
2010-12-04 20:03:02 +00:00
|
|
|
for x in range(51, 100):
|
|
|
|
key = '%-32d' % x
|
|
|
|
store2.delete(0, key)
|
2011-07-02 18:39:22 +00:00
|
|
|
self.assertEqual(len(list(store2.list(0))), 0)
|
2010-05-26 19:41:55 +00:00
|
|
|
|
|
|
|
|
2010-10-19 19:08:42 +00:00
|
|
|
def suite():
|
2010-10-26 19:25:25 +00:00
|
|
|
return unittest.TestLoader().loadTestsFromTestCase(StoreTestCase)
|
2010-10-19 19:08:42 +00:00
|
|
|
|
2010-05-26 19:41:55 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|