예제 #1
0
    def _create_chunk(self, rawx_path):
        container_id = generate_id(64)
        content_id = generate_id(64)
        chunk_id = generate_id(64)

        chunk_dir = "%s/%s" % (rawx_path, chunk_id[0:2])
        if not os.path.isdir(chunk_dir):
            os.makedirs(chunk_dir)

        chunk_path = "%s/%s" % (chunk_dir, chunk_id)
        with open(chunk_path, "w") as f:
            f.write("toto")

        xattr.setxattr(chunk_path, 'user.grid.chunk.hash', 32 * '0')
        xattr.setxattr(chunk_path, 'user.grid.chunk.id', chunk_id)
        xattr.setxattr(chunk_path, 'user.grid.chunk.position', '0')
        xattr.setxattr(chunk_path, 'user.grid.chunk.size', '4')
        xattr.setxattr(chunk_path, 'user.grid.content.container', container_id)
        xattr.setxattr(chunk_path, 'user.grid.content.id', content_id)
        xattr.setxattr(chunk_path, 'user.grid.content.nbchunk', '1')
        xattr.setxattr(chunk_path, 'user.grid.content.path', 'toto')
        xattr.setxattr(chunk_path, 'user.grid.content.size', '4')
        xattr.setxattr(chunk_path, 'user.grid.content.mime_type',
                       'application/octet-stream')
        xattr.setxattr(chunk_path, 'user.grid.content.storage_policy',
                       'TESTPOLICY')
        xattr.setxattr(chunk_path, 'user.grid.content.chunk_method', 'bytes')
        xattr.setxattr(chunk_path, 'user.grid.content.version', '0')

        return chunk_path, container_id, content_id, chunk_id
예제 #2
0
    def _create_chunk(self, rawx_path, alias="toto"):
        container_id = generate_id(64)
        content_id = generate_id(64)
        chunk_id = generate_id(64)

        chunk_dir = "%s/%s" % (rawx_path, chunk_id[0:3])
        if not os.path.isdir(chunk_dir):
            os.makedirs(chunk_dir)

        chunk_path = "%s/%s" % (chunk_dir, chunk_id)
        with open(chunk_path, "w") as f:
            f.write("toto")

        xattr.setxattr(chunk_path, 'user.grid.chunk.hash', 32 * '0')
        xattr.setxattr(chunk_path, 'user.grid.chunk.id', chunk_id)
        xattr.setxattr(chunk_path, 'user.grid.chunk.position', '0')
        xattr.setxattr(chunk_path, 'user.grid.chunk.size', '4')
        xattr.setxattr(chunk_path, 'user.grid.content.container', container_id)
        xattr.setxattr(chunk_path, 'user.grid.content.id', content_id)
        xattr.setxattr(chunk_path, 'user.grid.content.nbchunk', '1')
        xattr.setxattr(chunk_path, 'user.grid.content.path', alias)
        xattr.setxattr(chunk_path, 'user.grid.content.size', '4')
        xattr.setxattr(chunk_path, 'user.grid.content.mime_type',
                                   'application/octet-stream')
        xattr.setxattr(chunk_path, 'user.grid.content.storage_policy',
                                   'TESTPOLICY')
        xattr.setxattr(chunk_path, 'user.grid.content.chunk_method',
                                   'bytes')
        xattr.setxattr(chunk_path, 'user.grid.content.version', '0')

        return chunk_path, container_id, content_id, chunk_id
예제 #3
0
    def _create_chunk(self, rawx_path):
        container_id = generate_id(64)
        content_id = generate_id(64)
        chunk_id = generate_id(64)

        chunk_dir = "%s/%s" % (rawx_path, chunk_id[0:2])
        if not os.path.isdir(chunk_dir):
            os.makedirs(chunk_dir)

        chunk_path = "%s/%s" % (chunk_dir, chunk_id)
        with open(chunk_path, "w") as f:
            f.write("toto")

        xattr.setxattr(chunk_path, "user.grid.chunk.hash", 32 * "0")
        xattr.setxattr(chunk_path, "user.grid.chunk.id", chunk_id)
        xattr.setxattr(chunk_path, "user.grid.chunk.position", "0")
        xattr.setxattr(chunk_path, "user.grid.chunk.size", "4")
        xattr.setxattr(chunk_path, "user.grid.content.container", container_id)
        xattr.setxattr(chunk_path, "user.grid.content.id", content_id)
        xattr.setxattr(chunk_path, "user.grid.content.nbchunk", "1")
        xattr.setxattr(chunk_path, "user.grid.content.path", "toto")
        xattr.setxattr(chunk_path, "user.grid.content.size", "4")
        xattr.setxattr(chunk_path, "user.grid.content.version", "0")

        return chunk_path, container_id, content_id, chunk_id
예제 #4
0
 def __init__(self, test_conf, data, pos, rawx, content):
     self.test_conf = test_conf
     self.id = generate_id(64)
     self.data = data
     self.size = len(data)
     h = hashlib.new('md5')
     h.update(data)
     self.hash = h.hexdigest().upper()
     self.pos = pos
     self.url = "http://%s/%s" % (self.test_conf['rawx'][rawx]['addr'],
                                  self.id)
     self.content = content
예제 #5
0
 def __init__(self, test_conf, data, pos, rawx, content):
     self.test_conf = test_conf
     self.id = generate_id(64)
     self.data = data
     self.size = len(data)
     h = hashlib.new('md5')
     h.update(data)
     self.hash = h.hexdigest().upper()
     self.pos = pos
     self.url = "http://%s/%s" % (self.test_conf['rawx'][rawx]['addr'],
                                  self.id)
     self.content = content
예제 #6
0
 def __init__(self, test_conf, account,
              container_name, content_name, stgpol):
     self.test_conf = test_conf
     self.account = account
     self.container_name = container_name
     self.content_name = content_name
     self.content_id = generate_id(32)
     self.container_id = cid_from_name(self.account,
                                       self.container_name).upper()
     self.hash = 32 * '0'
     self.version = "0"
     self.size = 0
     self.chunks = []
     self.stgpol = stgpol
예제 #7
0
 def __init__(self, test_conf, account, container_name, content_name,
              stgpol):
     self.test_conf = test_conf
     self.account = account
     self.container_name = container_name
     self.content_name = content_name
     self.content_id = generate_id(32)
     self.container_id = cid_from_name(self.account,
                                       self.container_name).upper()
     self.hash = 32 * '0'
     self.version = "0"
     self.size = 0
     self.chunks = []
     self.stgpol = stgpol