Пример #1
0
 def retrieve_data_nomaintain(self, version):
     merged = dict()
     if version not in self.version_graph.nodes:
         return merged, [version, version]
     for delta in self.version_graph[version:]:
         merged = utils.merge_state_delta(merged, delta)
     return merged, [version, self.version_graph.head.current]
Пример #2
0
 def retreive_data(self):
     if len(self.diff) > 0:
         final_diff = Diff(utils.merge_state_delta(self.pending_commit, self.diff))
         final_diff.version = self.diff.version
         versions = self._get_next_version()
         self.pending_commit = final_diff
         self.diff = Diff()
         return final_diff, versions 
     return dict(), None
Пример #3
0
 def receive_data(self, data, version):
     if data:
         deleted_oids = utils.get_deleted(data)
         for tpname, oid in deleted_oids:
             self._release_control(self.type_map[tpname], oid)
         self.data = utils.merge_state_delta(
             self.data, data, delete_it=True)
     self.version = self._extract_new_version(version)
     return True
Пример #4
0
 def retreive_data(self):
     if len(self.diff) > 0:
         final_diff = Diff(
             utils.merge_state_delta(self.pending_commit, self.diff))
         final_diff.version = self.diff.version
         versions = self._get_next_version()
         self.pending_commit = final_diff
         self.diff = Diff()
         return final_diff, versions
     return dict(), None
Пример #5
0
 def receive_data(self, data, version):
     if data:
         deleted_oids = utils.get_deleted(data)
         for tpname, oid in deleted_oids:
             self._release_control(self.type_map[tpname], oid)
         self.data = utils.merge_state_delta(self.data,
                                             data,
                                             delete_it=True)
     self.version = self._extract_new_version(version)
     return True
Пример #6
0
 def retreive_data(self):
     with self.access_lock.gen_wlock():
         if self.diff:
             final_diff = Diff(
                 utils.merge_state_delta(self.pending_commit, self.diff))
             final_diff.version = self.diff.version
             versions = self._get_next_version()
             self.pending_commit = final_diff
             self.diff = Diff()
             return final_diff, versions
         return dict(), None
Пример #7
0
 def retrieve_data_nomaintain(self, version, req_types=None):
     obtainable_types = self.process_req_types(req_types)
     merged = dict()
     next_version = version
     try:
         for next_version, delta in self.version_graph[version:]:
             package = {
                 tpname: delta[tpname]
                 for tpname in obtainable_types if tpname in delta
             }
             merged = utils.merge_state_delta(merged, package)
     except KeyError:
         print(self.state_to_app, self.app_to_state)
         raise
     return merged, [version, next_version]