@Override public void deleteTable(TableReference tableRef) throws IOException, InterruptedException { validateWholeTableReference(tableRef); synchronized (tables) { Map<String, TableContainer> dataset = tables.get(tableRef.getProjectId(), tableRef.getDatasetId()); if (dataset == null) { throwNotFound( "Tried to get a dataset %s:%s, but no such table was set", tableRef.getProjectId(), tableRef.getDatasetId()); } dataset.remove(tableRef.getTableId()); } }
@Override public void createTable(Table table) throws IOException { TableReference tableReference = table.getTableReference(); validateWholeTableReference(tableReference); synchronized (tables) { Map<String, TableContainer> dataset = tables.get(tableReference.getProjectId(), tableReference.getDatasetId()); if (dataset == null) { throwNotFound( "Tried to get a dataset %s:%s, but no such table was set", tableReference.getProjectId(), tableReference.getDatasetId()); } dataset.computeIfAbsent(tableReference.getTableId(), k -> new TableContainer(table)); } }
@Override public Table patchTableDescription( TableReference tableReference, @Nullable String tableDescription) throws IOException, InterruptedException { validateWholeTableReference(tableReference); synchronized (tables) { TableContainer tableContainer = getTableContainer( tableReference.getProjectId(), tableReference.getDatasetId(), tableReference.getTableId()); tableContainer.getTable().setDescription(tableDescription); return tableContainer.getTable(); } }