class documentation
class SimpleCompressionStrategy(BaseCompressionStrategy):
Constructor: SimpleCompressionStrategy(zim, compression_type, max_size)
A compression strategy that compresses into a single cluster.
New clusters are created if the current cluster's uncompressed size would exceed SimpleCompressionStrategy.max_size.
| Method | __init__ |
The default constructor. |
| Method | add |
Handle the addition of an item (e.g. create entries, ...). |
| Method | flush |
Flush all current items. |
| Method | has |
True if this compression strategy still has items to be written. |
| Instance Variable | cluster |
current cluster |
| Instance Variable | compression |
compression type to use |
| Instance Variable | entries |
list of entries to compress |
| Instance Variable | max |
max (uncompressed) size the cluster should have. This may be exceeded. |
| Method | _finalize |
Finalize the current cluster, writing it and the various items. |
| Method | _new |
Instantiate a new cluster. |
| Method | _new |
Check if a new cluster is needed for the item. |
| Instance Variable | _lock |
thread safety lock |
Inherited from BaseCompressionStrategy:
| Instance Variable | zim |
zim archive this compression strategy compresses for |
The default constructor.
| Parameters | |
zim:pyzim.archive.Zim | zim archive this compression strategy compresses for |
compressionpyzim.compression.CompressionType | compression type to use |
maxint | max (uncompressed) size the cluster should have. This may be exceeded. |
True if this compression strategy still has items to be written.
| Returns | |
bool | whether there are some items that still need to be written |
Instantiate a new cluster.
The new cluster is in SimpleCompressionStrategy.cluster. This method does not take care of flushing the previous cluster.
Check if a new cluster is needed for the item.
| Parameters | |
item:pyzim.item.Item | item to check |
| Returns | |
bool | True if the current cluster should be finalized. |