Home

Awesome

Storages

Overview

This library provides a generic interface for multiple file storages:

Installation

pip install https://github.com/SYSTRAN/storages/archive/master.tar.gz

This installs the package systran-storages and command line utility systran-storages-cli allowing to easily test the connections to the different services.

Features

For each service, the library provides the following functions:

Configuration

Configuration of the services is done with a JSON dictionary: {"key1": DEF1, "key2": DEF2, ..., "keyN": DEFN}, where key1...keyN are the identifiers of each storage, and DEF1...DEFN their configuration.

Configurations DEFI are JSON dictionary with following fields:

{
	"description": "description of the storage (optional)",
	"type": "local|ssh|s3|swift|http",
	[STORAGE_OPTIONS]
}

The dictionary is passed to the StorageClient constructor:

from systran_storages import StorageClient

client = StorageClient(services)

systran_storages/bin/storages_cli.py gives a comprehensive usage example.

Usage

The different services are method of the client object where remote_path is a string in the format storage:path:

Paths use / delimiter. Path starts with / and no relative path accessor like ., .. are supported. For the storages with actual directory structure (S3, Swift, ...), a hierarchical file organization is simulated.

Services

Local

Type of the service is local.

Storage options:

SSH

Type of the service is ssh.

Storage options:

S3

Type of the service is s3.

Storage options:

Swift

Type of the service is swift.

Storage options:

HTTP

Type of the service is http.

Storage options:

Note HTTP storages do not define all the possible functions: