def add_graph_struct(self, graph_name: str, graph_struct: GraphStruct) -> int: graph_view = self.graphs.collection_view(graph_name) graph_struct.graph_name = graph_name try: new_revision = self.read_graph_struct(graph_name).revision + 1 except: new_revision = 0 graph_struct.revision = new_revision # FIXME(luckygeck): possible race condition graph_view.put(str(new_revision), graph_struct.to_json()) return new_revision