mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(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
This commit is contained in:
parent
750c78763e
commit
5aed22dc1e
@ -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');
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user