コード例 #1
0
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import shutil
import leveldb

from oslo.config import cfg

from gate.common import log as logging
from gate.common import jsonutils
from gate.engine.storage.container import StorageContainer
from gate.engine.storage.drivers import StorageDriverBase, StorageError, STOR_REG

LOG = logging.getLogger(__name__)

cfg.CONF.register_opts([
    cfg.StrOpt('storage_leveldb_container_prefix',
               default='container_',
               help='Container database prefix.'),
])


class LevelDBDriver(StorageDriverBase):
    def __init__(self, storage_url):
        if not storage_url.startswith('leveldb:'):
            raise StorageError('Invalid storage url.')
        self.storage_url = storage_url
        self._path = self.storage_url.replace('leveldb://', '', 1)
        self._container_prefix = cfg.CONF.storage_leveldb_container_prefix
コード例 #2
0
ファイル: level.py プロジェクト: vindeka/gate
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import shutil
import leveldb

from oslo.config import cfg

from gate.common import log as logging
from gate.common import jsonutils
from gate.engine.storage.container import StorageContainer
from gate.engine.storage.drivers import StorageDriverBase, StorageError, STOR_REG

LOG = logging.getLogger(__name__)


cfg.CONF.register_opts([
    cfg.StrOpt('storage_leveldb_container_prefix',
               default='container_',
               help='Container database prefix.'),
])


class LevelDBDriver(StorageDriverBase):

    def __init__(self, storage_url):
        if not storage_url.startswith('leveldb:'):
            raise StorageError('Invalid storage url.')
        self.storage_url = storage_url