module documentation

Policies for class behavior.

Policies are basically configurations managing the behavior of various classes and which classes are choosen. For example, a policy may specify whether a cluster should be decompressed all at once or only as needed.

Generally speaking, policies should not have any effect on the content of a ZIM file, but may affect the structure. An example would be the choosen compression level and type for a cluster.

Class Policy A policy is a configuration that influences the behavior of various pyzim classes, mostly in regards to resource management.
Constant ALL_POLICIES a list of all policies defined in this module, used for testing
Constant DEFAULT_POLICY the default policy to use
Constant HIGH_PERFORMANCE_DECOMP_POLICY a policy for maximizing performance during decompression
Constant LOW_RAM_DECOMP_POLICY A policy for minimizing RAM usage during decompression
ALL_POLICIES: list of Policy =

a list of all policies defined in this module, used for testing

Value
[DEFAULT_POLICY, LOW_RAM_DECOMP_POLICY, HIGH_PERFORMANCE_DECOMP_POLICY]
DEFAULT_POLICY: Policy =

the default policy to use

Value
Policy()
HIGH_PERFORMANCE_DECOMP_POLICY: Policy =

a policy for maximizing performance during decompression

Value
Policy(compression_options={'general.target': CompressionTarget.FASTEST_DECOMPRESSION
},
       cluster_class=InMemoryCluster,
       cluster_cache_class=HybridCache,
       cluster_cache_kwargs={'last_cache_size': 8, 'top_cache_size': 8},
       entry_cache_class=HybridCache,
       entry_cache_kwargs={'last_cache_size': 8, 'top_cache_size': 128})
LOW_RAM_DECOMP_POLICY: Policy =

A policy for minimizing RAM usage during decompression

Value
Policy(compression_options={'general.target': CompressionTarget.LOWRAM_DECOMPRESSION
},
       cluster_class=Cluster,
       simple_pointer_list_class=OnDiskSimplePointerList,
       ordered_pointer_list_class=OnDiskOrderedPointerList,
       title_pointer_list_class=OnDiskTitlePointerList,
       cluster_cache_class=NoOpCache,
...