예제 #1
0
 def destroy(self, _table):
     for p in range(_table.partition):
         proc_id = p % len(EggRoll.proc_list)
         i = self.__get_index_by_proc(proc_id)
         stub = self.egg_list[i]
         stub.destroy(kv_pb2.Empty(),
                      metadata=self.__get_meta(_table, str(p)))
예제 #2
0
 def count(self, _table):
     count = 0
     for p in range(_table.partition):
         proc_id = p % len(EggRoll.proc_list)
         i = self.__get_index_by_proc(proc_id)
         stub = self.egg_list[i]
         count += stub.count(kv_pb2.Empty(),
                             metadata=self.__get_meta(_table, str(p))).value
     return count
예제 #3
0
파일: eggroll.py 프로젝트: itboyljm/eggroll
                                          _table._name), ('name_space',
                                                          _table._namespace)


def to_pb_store_type(_type: StoreType, persistent=False):
    result = None
    if not persistent:
        result = storage_basic_pb2.IN_MEMORY
    elif _type == StoreType.LMDB:
        result = storage_basic_pb2.LMDB
    elif _type == StoreType.LEVEL_DB:
        result = storage_basic_pb2.LEVEL_DB
    return result


empty = kv_pb2.Empty()


class _DTable(object):
    def __init__(self,
                 storage_locator,
                 partitions=1,
                 in_place_computing=False):
        # self.__client = _EggRoll.get_instance()
        self._namespace = storage_locator.namespace
        self._name = storage_locator.name
        self._type = storage_basic_pb2.StorageType.Name(storage_locator.type)
        self._partitions = partitions
        self.schema = {}
        self._in_place_computing = in_place_computing
        self.gc_enable = True