class Model_CompressPickle(IndexedRedisModel): FIELDS = [ IRField('name'), IRFieldChain( 'value', [IRPickleField(), IRCompressedField()]), IRFieldChain( 'value2', [IRPickleField(), IRCompressedField()], defaultValue=['a', 'b', 'c']) ] INDEXED_FIELDS = ['name'] KEY_NAME = 'TestIRFieldChain__ModelCompressPickle'
class Model_CompressedDefaultValue(IndexedRedisModel): FIELDS = [ IRField('name'), IRCompressedField('value', defaultValue=b'woobley'), ] INDEXED_FIELDS = ['name'] KEY_NAME = 'TestIRCompressedField__CompressedDefaultValue'
class Model_GeneralCompressed(IndexedRedisModel): FIELDS = [ IRField('name'), IRCompressedField('value', defaultValue=irNull), ] INDEXED_FIELDS = ['name'] KEY_NAME = 'TestIRCompressedField__GeneralCompressed'
class Model_CompressLzma(IndexedRedisModel): FIELDS = [ IRField('name'), IRCompressedField('value', compressMode='lzma', defaultValue=irNull), ] INDEXED_FIELDS = ['name'] KEY_NAME = 'TestIRCompressedField__CompressLzma'
class MyChainedModel(IndexedRedisModel): FIELDS = [ \ IRField('name'), IRFieldChain('data', [IRField(valueType=IRJsonValue), IRCompressedField(), IRBase64Field()]) , ] INDEXED_FIELDS = [ \ 'name', ] KEY_NAME = 'MyChainedModel'
class BadModel1(IndexedRedisModel): FIELDS = [ IRField('name'), IRFieldChain( 'value', [IRPickleField(), IRCompressedField()]) ] INDEXED_FIELDS = ['name', 'value'] KEY_NAME = 'TestIRFieldChain__BadModel1'
class MyCompressModel(IndexedRedisModel): FIELDS = [ \ IRField('name'), IRFieldChain('data', [IRBytesField(), IRCompressedField()]), ] INDEXED_FIELDS = [ \ 'name', # 'data', ] KEY_NAME = 'MyCompressModel'
class Model_Utf16Compression(IndexedRedisModel): FIELDS = [ IRField('name'), IRFieldChain('value', [ IRUnicodeField(encoding='utf-16'), IRCompressedField() ]), ] INDEXED_FIELDS = ['name'] KEY_NAME = 'TestIRFieldChain__Utf16Compression'
class Song(IndexedRedisModel): FIELDS = [ \ IRField('artist'), IRField('title'), IRField('album'), IRField('track_number', valueType=int), # Convert automatically to/from int IRField('duration'), IRField('releaseDate', valueType=datetime.datetime), IRField('description'), IRField('copyright'), IRRawField('mp3_data'), # Do not perform any conversion on the data. IRFieldChain('thumbnail', [IRBytesField(), IRCompressedField(compressMode='gzip')]), # Compress this field in storage using "gzip" compression IRField('tags', valueType=list), IRFieldChain('lyrics', [ IRUnicodeField(encoding='utf-8'), IRCompressedField() ], defaultValue='No lyrics found'), ] INDEXED_FIELDS = [ \ 'artist', 'title', 'track_number', ] KEY_NAME = 'Songs'
class NetFetchCompressedBzip2File(NetFetchFile): ''' NetFetchCompressedBzip2File - Used for bzip2 compression on a NetFetchFile ''' NETFETCH_TYPE = NETFETCH_TYPE_COMPRESSED_BZIP2 FIELDS = [ IRField('filename'), IRField('hostname'), IRField('checksum'), IRField('encrypted'), IRField('mode'), IRField('owner'), IRField('group'), IRField('netfetchType', valueType=int, defaultValue=NETFETCH_TYPE_COMPRESSED_BZIP2), IRFieldChain('data', [IRBytesField(), IRCompressedField(compressMode='bzip2')]), ]
class Model_CompressedIndex(IndexedRedisModel): FIELDS = [IRField('name'), IRCompressedField('value')] INDEXED_FIELDS = ['name', 'value'] KEY_NAME = 'TestIRCompressedField__CompressedIndex'