Expose supported compression and serialization types.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
This commit is contained in:
parent
fe49c35c14
commit
219116d414
1 changed files with 15 additions and 2 deletions
|
|
@ -38,7 +38,15 @@ class DatabaseVersion(int):
|
|||
|
||||
Returns None if compression is not enabled.
|
||||
"""
|
||||
return (None, "xz")[self.compression_version()]
|
||||
return self.compression_types()[self.compression_version()]
|
||||
|
||||
@staticmethod
|
||||
def compression_types():
|
||||
"""A tuple containing supported compression types.
|
||||
|
||||
None is used to indicate the lack of compression.
|
||||
"""
|
||||
return (None, "xz")
|
||||
|
||||
def serialization_version(self):
|
||||
"""The value indicating the format in which the data is serialized."""
|
||||
|
|
@ -49,7 +57,12 @@ class DatabaseVersion(int):
|
|||
|
||||
This value is suitable for passing to a FileStorage object.
|
||||
"""
|
||||
return ("csv", "pickle", "json")[self.serialization_version()]
|
||||
return self.serialization_types()[self.serialization_version()]
|
||||
|
||||
@staticmethod
|
||||
def serialization_types():
|
||||
"""A tuple indicating the formats in which data can be serialized."""
|
||||
return ("csv", "pickle", "json")
|
||||
|
||||
def record_version(self):
|
||||
"""The record version.
|
||||
|
|
|
|||
Loading…
Reference in a new issue