Exemplo n.º 1
0
def get_pithos_backend():
    global _pithos_backend_pool
    if _pithos_backend_pool is None:
        _pithos_backend_pool = PithosBackendPool(
            settings.PITHOS_BACKEND_POOL_SIZE,
            astakos_auth_url=settings.ASTAKOS_AUTH_URL,
            service_token=settings.CYCLADES_SERVICE_TOKEN,
            astakosclient_poolsize=settings.CYCLADES_ASTAKOSCLIENT_POOLSIZE,
            db_connection=settings.BACKEND_DB_CONNECTION,
            archipelago_conf_file=settings.PITHOS_BACKEND_ARCHIPELAGO_CONF,
            xseg_pool_size=settings.PITHOS_BACKEND_XSEG_POOL_SIZE,
            map_check_interval=settings.PITHOS_BACKEND_MAP_CHECK_INTERVAL,
            resource_max_metadata=settings.PITHOS_RESOURCE_MAX_METADATA)
    return _pithos_backend_pool.pool_get()
Exemplo n.º 2
0
def get_pithos_backend():
    global _pithos_backend_pool
    if _pithos_backend_pool is None:
        _pithos_backend_pool = PithosBackendPool(
            settings.PITHOS_BACKEND_POOL_SIZE,
            astakos_auth_url=settings.ASTAKOS_AUTH_URL,
            service_token=settings.CYCLADES_SERVICE_TOKEN,
            astakosclient_poolsize=settings.CYCLADES_ASTAKOSCLIENT_POOLSIZE,
            db_connection=settings.BACKEND_DB_CONNECTION,
            archipelago_conf_file=settings.PITHOS_BACKEND_ARCHIPELAGO_CONF,
            xseg_pool_size=settings.PITHOS_BACKEND_XSEG_POOL_SIZE,
            map_check_interval=settings.PITHOS_BACKEND_MAP_CHECK_INTERVAL,
            resource_max_metadata=settings.PITHOS_RESOURCE_MAX_METADATA)
    return _pithos_backend_pool.pool_get()
Exemplo n.º 3
0
    hash_algorithm=BACKEND_HASH_ALGORITHM,
    queue_module=BACKEND_QUEUE_MODULE,
    queue_hosts=BACKEND_QUEUE_HOSTS,
    queue_exchange=BACKEND_QUEUE_EXCHANGE,
    astakos_auth_url=ASTAKOS_AUTH_URL,
    service_token=SERVICE_TOKEN,
    astakosclient_poolsize=ASTAKOSCLIENT_POOLSIZE,
    free_versioning=BACKEND_FREE_VERSIONING,
    block_params=BLOCK_PARAMS,
    public_url_security=PUBLIC_URL_SECURITY,
    public_url_alphabet=PUBLIC_URL_ALPHABET,
    account_quota_policy=BACKEND_ACCOUNT_QUOTA,
    container_quota_policy=BACKEND_CONTAINER_QUOTA,
    container_versioning_policy=BACKEND_VERSIONING)

_pithos_backend_pool = PithosBackendPool(size=BACKEND_POOL_SIZE,
                                         **BACKEND_KWARGS)


def get_backend():
    if BACKEND_POOL_ENABLED:
        backend = _pithos_backend_pool.pool_get()
    else:
        backend = connect_backend(**BACKEND_KWARGS)
    backend.serials = []
    backend.messages = []
    return backend


def update_request_headers(request):
    # Handle URL-encoded keys and values.
    meta = dict([(
Exemplo n.º 4
0
PLANKTON_DOMAIN = 'plankton'
PLANKTON_PREFIX = 'plankton:'
PROPERTY_PREFIX = 'property:'

PLANKTON_META = ('container_format', 'disk_format', 'name', 'status',
                 'created_at')

MAX_META_KEY_LENGTH = 128 - len(PLANKTON_DOMAIN) - len(PROPERTY_PREFIX)
MAX_META_VALUE_LENGTH = 256

from pithos.backends.util import PithosBackendPool
_pithos_backend_pool = \
    PithosBackendPool(
        settings.PITHOS_BACKEND_POOL_SIZE,
        astakos_auth_url=settings.ASTAKOS_AUTH_URL,
        service_token=settings.CYCLADES_SERVICE_TOKEN,
        astakosclient_poolsize=settings.CYCLADES_ASTAKOSCLIENT_POOLSIZE,
        db_connection=settings.BACKEND_DB_CONNECTION,
        block_path=settings.BACKEND_BLOCK_PATH)


def get_pithos_backend():
    return _pithos_backend_pool.pool_get()


def create_url(account, container, name):
    assert "/" not in account, "Invalid account"
    assert "/" not in container, "Invalid container"
    return "pithos://%s/%s/%s" % (account, container, name)

Exemplo n.º 5
0
else:
    BLOCK_PARAMS = {
        'mappool': None,
        'blockpool': None,
    }

_pithos_backend_pool = PithosBackendPool(
    size=BACKEND_POOL_SIZE,
    db_module=BACKEND_DB_MODULE,
    db_connection=BACKEND_DB_CONNECTION,
    block_module=BACKEND_BLOCK_MODULE,
    block_path=BACKEND_BLOCK_PATH,
    block_umask=BACKEND_BLOCK_UMASK,
    queue_module=BACKEND_QUEUE_MODULE,
    queue_hosts=BACKEND_QUEUE_HOSTS,
    queue_exchange=BACKEND_QUEUE_EXCHANGE,
    astakos_url=ASTAKOS_BASE_URL,
    service_token=SERVICE_TOKEN,
    astakosclient_poolsize=ASTAKOSCLIENT_POOLSIZE,
    free_versioning=BACKEND_FREE_VERSIONING,
    block_params=BLOCK_PARAMS,
    public_url_security=PUBLIC_URL_SECURITY,
    public_url_alphabet=PUBLIC_URL_ALPHABET,
    account_quota_policy=BACKEND_ACCOUNT_QUOTA,
    container_quota_policy=BACKEND_CONTAINER_QUOTA,
    container_versioning_policy=BACKEND_VERSIONING)


def get_backend():
    backend = _pithos_backend_pool.pool_get()
    backend.messages = []
    return backend