Commit 8e2651ab authored by Chrysostomos Nanakos's avatar Chrysostomos Nanakos
Browse files

pithos: Propagate selectable storage backend

Propagate selectable storage backend to blocker and mapper.
parent cdf80dab
# Copyright 2011-2012 GRNET S.A. All rights reserved.
# Copyright 2011-2014 GRNET S.A. All rights reserved.
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
......@@ -35,6 +35,7 @@ import os
from blocker import Blocker
from mapper import Mapper
from store_helpers import bootstrap_backend_storage
class Store(object):
......@@ -44,25 +45,10 @@ class Store(object):
def __init__(self, **params):
umask = params['umask']
if umask is not None:
path = params['path']
if path and not os.path.exists(path):
if not os.path.isdir(path):
raise RuntimeError("Cannot open path '%s'" % (path,))
p = {'blocksize': params['block_size'],
'blockpath': os.path.join(path + '/blocks'),
'hashtype': params['hash_algorithm'],
'blockpool': params['blockpool']}
self.blocker = Blocker(**p)
p = {'mappath': os.path.join(path + '/maps'),
'namelen': self.blocker.hashlen,
'mappool': params['mappool']}
self.mapper = Mapper(**p)
(pb, pm) = bootstrap_backend_storage(params['backend_storage'],
self.blocker = Blocker(**pb)
self.mapper = Mapper(**pm)
def map_get(self, name):
return self.mapper.map_retr(name)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment