Class SequenceServer
source code
Given a sequence to serve, this class dishes them out in chunks or one
at a time. This was written originally to reduce redundant code. Used
only by class Syncer.
This class was written so that a chunk can be snagged and processed.
If the processing fails, one can tell the class to only present one at a
time until that chunk is complete... and then resume normal
operations.
For example: the sequence can be a bunch of packageIds. We try to
process all data that corresponds to some chunk of those package ids. If
that process fails, we go back and reprocess that chunk, one at a time,
until it is complete (identifying precisely which package broke). Then we
resume processing a chunk at a time.
|
__init__(self,
seq,
divisor=None,
neverlessthan=None,
nevermorethan=None)
Constructor. |
source code
|
|
|
|
|
clearChunk(self)
zero the self.chunk you were working with. |
source code
|
|
|
|
|
DIVISOR = 10
|
|
NEVER_LESS_THAN = 10
|
|
NEVER_MORE_THAN = 50
|
__init__(self,
seq,
divisor=None,
neverlessthan=None,
nevermorethan=None)
(Constructor)
| source code
|
Constructor.
Arguments:
seq - any sequence to server chunks of
divisor - the chunk size: 10 would be 1/10th of the seq length
neverlessthan - chunk-size is never less than this (unless out
of data).
nevermorethan - chunk-size if never more than this number.
|
fetch a chunk from the sequence. Does not refresh the chunk until you
self.clearChunk()
|