Revision 401777e9 snf-pithos-backend/pithos/backends/lib/hashfiler/mapper.py
b/snf-pithos-backend/pithos/backends/lib/hashfiler/mapper.py | ||
---|---|---|
34 | 34 |
from pithos.api.settings import PITHOS_BACKEND_STORAGE |
35 | 35 |
from store_helpers import get_mapper |
36 | 36 |
|
37 |
|
|
37 | 38 |
class Mapper(object): |
38 | 39 |
"""Mapper. |
39 | 40 |
Required constructor parameters: mappath, namelen. |
... | ... | |
41 | 42 |
""" |
42 | 43 |
|
43 | 44 |
def __init__(self, **params): |
44 |
fmap, rmap = get_mapper(PITHOS_BACKEND_STORAGE,**params) |
|
45 |
fmap, rmap = get_mapper(PITHOS_BACKEND_STORAGE, **params)
|
|
45 | 46 |
self.rmap = rmap |
46 | 47 |
self.fmap = fmap |
47 | 48 |
|
... | ... | |
51 | 52 |
By default, return the whole hashes map. |
52 | 53 |
""" |
53 | 54 |
if self.fmap: |
54 |
return self.fmap.map_retr(maphash, blkoff, nr)
|
|
55 |
return self.fmap.map_retr(maphash, blkoff, nr) |
|
55 | 56 |
elif self.rmap: |
56 | 57 |
return self.rmap.map_retr(maphash, blkoff, nr) |
57 | 58 |
|
58 | 59 |
def map_stor(self, maphash, hashes=(), blkoff=0, create=1): |
59 | 60 |
"""Store hashes in the given hashes map.""" |
60 | 61 |
if self.rmap: |
61 |
return self.rmap.map_stor(maphash, hashes, blkoff, create)
|
|
62 |
return self.rmap.map_stor(maphash, hashes, blkoff, create) |
|
62 | 63 |
elif self.fmap: |
63 | 64 |
return self.fmap.map_stor(maphash, hashes, blkoff, create) |
Also available in: Unified diff