public class AlterSoupLongOperation extends LongOperation
Modifier and Type | Class and Description |
---|---|
static class |
AlterSoupLongOperation.AlterSoupStep
Enum for alter steps
|
LongOperation.LongOperationType
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
soupName |
static java.lang.String |
TAG |
Constructor and Description |
---|
AlterSoupLongOperation()
Default constructor when reading back from long operations status table
Should be followed by a call to: initFromDbRow
|
AlterSoupLongOperation(SmartStore store,
java.lang.String soupName,
IndexSpec[] newIndexSpecs,
boolean reIndexData)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
copyTable()
Step 4: copy data from old soup table to new soup table
|
protected long |
createLongOperationDbRow()
Create row in long operations status table for a new alter soup operation
|
protected void |
dropOldIndexes()
Step 2: drop old indexes / remove entries in soup_index_map / cleaanup cache
|
protected void |
dropOldTable()
Step 6: drop old soup table
|
JSONObject |
getDetails() |
AlterSoupLongOperation.AlterSoupStep |
getLastStepCompleted() |
protected void |
initFromDbRow(SmartStore store,
long rowId,
JSONObject details,
java.lang.String statusStr) |
protected void |
registerSoupUsingTableName()
Step 3: register soup with new indexes
|
protected void |
reIndexSoup()
Step 5: re-index soup for new indexes (optional step)
|
protected void |
renameOldSoupTable()
Step 1: rename old table
|
void |
run()
Run long operation
|
void |
run(AlterSoupLongOperation.AlterSoupStep toStep)
Used by test only
|
protected void |
updateLongOperationDbRow(AlterSoupLongOperation.AlterSoupStep newStatus)
Update row in long operations status table for on-going alter soup operation
Delete row if newStatus is AlterStatus.LAST
|
public static final java.lang.String TAG
protected java.lang.String soupName
public AlterSoupLongOperation()
public AlterSoupLongOperation(SmartStore store, java.lang.String soupName, IndexSpec[] newIndexSpecs, boolean reIndexData) throws JSONException
store
- soupName
- newIndexSpecs
- reIndexData
- JSONException
public void run()
LongOperation
run
in class LongOperation
public void run(AlterSoupLongOperation.AlterSoupStep toStep)
toStep
- public AlterSoupLongOperation.AlterSoupStep getLastStepCompleted()
protected void initFromDbRow(SmartStore store, long rowId, JSONObject details, java.lang.String statusStr) throws JSONException
initFromDbRow
in class LongOperation
JSONException
protected void renameOldSoupTable()
protected void dropOldIndexes()
protected void registerSoupUsingTableName()
protected void copyTable()
protected void reIndexSoup()
protected void dropOldTable()
protected long createLongOperationDbRow() throws JSONException
JSONException
public JSONObject getDetails() throws JSONException
getDetails
in class LongOperation
JSONException
protected void updateLongOperationDbRow(AlterSoupLongOperation.AlterSoupStep newStatus)
newStatus
-