cubicweb/server/test/data/cubicweb_file/schema.py
author Philippe Pepiot <ph@itsalwaysdns.eu>
Tue, 31 Mar 2020 18:22:05 +0200
changeset 12966 6cd938c29ca3
parent 12515 2d43c8b30ef0
permissions -rw-r--r--
[server] Make connection pooler configurable and set better default values Drop the configuration connections-pool-size and add new configurations options: * connections-pool-min-size. Set to 0 by default so we open connections only when needed. This avoid opening min-size*processes connections at startup, which is, it think, a good default. * connections-pool-max-size. Set to 0 (unlimited) by default, so we move the bottleneck to postgresql. * connections-idle-timeout. Set to 10 minutes. I don't have arguments about this except that this is the default in pgbouncer.

from yams.buildobjs import EntityType, String, Bytes, RichString


class File(EntityType):
    """a downloadable file which may contains binary data"""
    title = String(fulltextindexed=True, maxsize=256)
    data = Bytes(required=True, description='file to upload')
    data_format = String(
        required=True, maxsize=128,
        description=('MIME type of the file. Should be dynamically set '
                     'at upload time.'))
    data_encoding = String(
        maxsize=32,
        description=('encoding of the file when it applies (e.g. text). '
                     'Should be dynamically set at upload time.'))
    data_name = String(
        required=True, fulltextindexed=True,
        description=('name of the file. Should be dynamically set '
                     'at upload time.'))
    data_hash = String(
        maxsize=256,  # max len of currently available hash alg + prefix is 140
        description=('hash of the file. May be set at upload time.'),
        __permissions__={'read': ('managers', 'users', 'guests'),
                         'add': (),
                         'update': ()})
    description = RichString(fulltextindexed=True, internationalizable=True,
                             default_format='text/rest')