def setUp(self):
     self.log = get_logger()
     db.create_all()
     self.service = ChunkService()
     self.service.register_chunk_server(MockChunkServer('s1', "/tmp"))
     self.service.register_chunk_server(MockChunkServer('s2', "/tmp"))
     self.service.register_chunk_server(MockChunkServer('s3', "/tmp"))
     self.service.register_chunk_server(MockChunkServer('s4', "/tmp"))
Beispiel #2
0
    def setUp(self) -> None:
        self.log = get_logger()
        self.config = Config()
        self.maker = ChunkMaker(self.config)

        self.path = '/tmp/chunk_maker_test'
        with open(self.path, 'wb') as of:
            for i in range(0, 1024 * 1204 * 3 + 512):
                of.write(b'a')

        self.sig = Hash.file_hash(self.path)
Beispiel #3
0
    def setUp(self):
        self.log = get_logger(__name__)
        db.create_all()
        self.fs = FileSystemService(db)

        self.path = '/tmp/file_system_test'
        with open(self.path, 'wb') as of:
            for i in range(0, 1024 * 1204 * 3 + 512):
                of.write(b'a')

        self.sig = Hash.file_hash(self.path)
Beispiel #4
0
 def __init__(self, config: Config) -> None:
     self.log = get_logger(__name__)
     self.config = config
     self.init()
Beispiel #5
0
 def __init__(self, db):
     self.log = get_logger('fs')
     self.db = db
     self.chunk_service = ChunkService()
     self.set_config(Config())
 def __init__(self, name: str, workspace: str) -> None:
     super().__init__(name, workspace)
     self.log = get_logger(__name__)
Beispiel #7
0
 def __init__(self) -> None:
     self.log = get_logger(__name__)
     self.chunk_servers: dict[str, ChunkServer] = {}
     self.idx: int = 0
     self.replica: int = 3
     self.executor = ThreadPoolExecutor(12)