From 5aed22dc1eea215e1b78767dce32a463f2dc86e7 Mon Sep 17 00:00:00 2001 From: Alex Hall Date: Wed, 4 Aug 2021 01:01:38 +0200 Subject: [PATCH] (core) Remove dead code for fetching snapshots Summary: Deletes code which was previously only used by SharedSharing.ts, which was deleted in D2894 Test Plan: no Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D2960 --- app/server/lib/ActiveDoc.ts | 5 ----- sandbox/grist/engine.py | 35 ----------------------------------- sandbox/grist/main.py | 5 ----- 3 files changed, 45 deletions(-) diff --git a/app/server/lib/ActiveDoc.ts b/app/server/lib/ActiveDoc.ts index b7be7b96..688654ef 100644 --- a/app/server/lib/ActiveDoc.ts +++ b/app/server/lib/ActiveDoc.ts @@ -1049,11 +1049,6 @@ export class ActiveDoc extends EventEmitter { return sandboxActionBundle; } - public async fetchSnapshot() { - await this.waitForInitialization(); - return this._pyCall('fetch_snapshot'); - } - // Needed for test/server/migrations.js tests public async testGetVersionFromDataEngine() { return this._pyCall('get_version'); diff --git a/sandbox/grist/engine.py b/sandbox/grist/engine.py index 24ec1953..eb13ced6 100644 --- a/sandbox/grist/engine.py +++ b/sandbox/grist/engine.py @@ -69,13 +69,6 @@ class OrderError(Exception): # An item of work to be done by Engine._update WorkItem = namedtuple('WorkItem', ('node', 'row_ids', 'locks')) -# Returns an AddTable action which can be used to reproduce the given docmodel table -def _get_table_actions(table): - schema_cols = [schema.make_column(c.colId, c.type, formula=c.formula, isFormula=c.isFormula) - for c in table.columns] - return actions.AddTable(table.tableId, schema_cols) - - # skip private members, and methods we don't want to expose to users. skipped_completions = re.compile(r'\.(_|lookupOrAddDerived|getSummarySourceGroup)') @@ -356,34 +349,6 @@ class Engine(object): return {table_id: self.fetch_table(table_id, formulas=formulas) for table_id in self.tables if table_id.startswith('_grist_')} - def fetch_snapshot(self): - """ - Returns a full list of actions which when applied sequentially recreate the doc database to - its current state. - """ - action_group = action_obj.ActionGroup() - action_group.stored = self._get_snapshot_actions() - return action_group - - def _get_snapshot_actions(self): - """ - Returns a list of action objects which recreate the document database when applied. - """ - schema_actions = schema.schema_create_actions() - table_actions = [_get_table_actions(table) for table in self.docmodel.tables.all] - record_actions = [ - self._get_record_actions(table_id) - for (table_id,t) in six.iteritems(self.tables) - if t.next_row_id() > 1 - ] - return schema_actions + table_actions + record_actions - - # Returns a BulkAddRecord action which can be used to add the currently existing data to an empty - # version of the table with the given table_id. - def _get_record_actions(self, table_id): - table_data = self.fetch_table(table_id, formulas=False) - return actions.BulkAddRecord(table_id, table_data.row_ids, table_data.columns) - def find_col_from_values(self, values, n, opt_table_id=None): """ Returns a list of colRefs for columns whose values match a given list. The results are ordered diff --git a/sandbox/grist/main.py b/sandbox/grist/main.py index 802aae97..74381ccc 100644 --- a/sandbox/grist/main.py +++ b/sandbox/grist/main.py @@ -67,11 +67,6 @@ def run(sandbox): def fetch_table_schema(): return eng.fetch_table_schema() - @export - def fetch_snapshot(): - action_group = eng.fetch_snapshot() - return eng.acl_split(action_group).to_json_obj() - @export def autocomplete(txt, table_id, column_id, user): return eng.autocomplete(txt, table_id, column_id, user)