Example #1
0
            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'
Example #2
0
            class Model_CompressedDefaultValue(IndexedRedisModel):
                FIELDS = [
                    IRField('name'),
                    IRCompressedField('value', defaultValue=b'woobley'),
                ]

                INDEXED_FIELDS = ['name']

                KEY_NAME = 'TestIRCompressedField__CompressedDefaultValue'
Example #3
0
            class Model_GeneralCompressed(IndexedRedisModel):

                FIELDS = [
                    IRField('name'),
                    IRCompressedField('value', defaultValue=irNull),
                ]

                INDEXED_FIELDS = ['name']

                KEY_NAME = 'TestIRCompressedField__GeneralCompressed'
Example #4
0
                class Model_CompressLzma(IndexedRedisModel):
                    FIELDS = [
                        IRField('name'),
                        IRCompressedField('value',
                                          compressMode='lzma',
                                          defaultValue=irNull),
                    ]

                    INDEXED_FIELDS = ['name']

                    KEY_NAME = 'TestIRCompressedField__CompressLzma'
Example #5
0
class MyChainedModel(IndexedRedisModel):

    FIELDS = [ \
        IRField('name'),
        IRFieldChain('data', [IRField(valueType=IRJsonValue), IRCompressedField(), IRBase64Field()]) ,
    ]

    INDEXED_FIELDS = [ \
        'name',
    ]

    KEY_NAME = 'MyChainedModel'
Example #6
0
        class BadModel1(IndexedRedisModel):

            FIELDS = [
                IRField('name'),
                IRFieldChain(
                    'value',
                    [IRPickleField(), IRCompressedField()])
            ]

            INDEXED_FIELDS = ['name', 'value']

            KEY_NAME = 'TestIRFieldChain__BadModel1'
Example #7
0
class MyCompressModel(IndexedRedisModel):

    FIELDS = [ \
        IRField('name'),
        IRFieldChain('data', [IRBytesField(), IRCompressedField()]),
    ]

    INDEXED_FIELDS = [ \
        'name',
    #        'data',
    ]

    KEY_NAME = 'MyCompressModel'
Example #8
0
            class Model_Utf16Compression(IndexedRedisModel):

                FIELDS = [
                    IRField('name'),
                    IRFieldChain('value', [
                        IRUnicodeField(encoding='utf-16'),
                        IRCompressedField()
                    ]),
                ]

                INDEXED_FIELDS = ['name']

                KEY_NAME = 'TestIRFieldChain__Utf16Compression'
Example #9
0
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'
Example #10
0
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')]),
    ]
Example #11
0
            class Model_CompressedIndex(IndexedRedisModel):
                FIELDS = [IRField('name'), IRCompressedField('value')]

                INDEXED_FIELDS = ['name', 'value']

                KEY_NAME = 'TestIRCompressedField__CompressedIndex'