-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add migrate operation intreface
- Loading branch information
1 parent
26dbc30
commit 2de5071
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package schemamigrator | ||
|
||
// Operation is the interface that all operations must implement. | ||
// An Operation that is not mutation, idempotent and lightweight is expected | ||
// to complete almost immediately given there are no blocking items in the | ||
// distributed_ddl_queue. | ||
// Such operations are completed synchronously and allow the release upgrade | ||
// to proceed. | ||
// All other operations are run asynchronously in the background and do not | ||
// block the release upgrade. | ||
type Operation interface { | ||
// ToSQL returns the SQL for the alter operation | ||
ToSQL() string | ||
// IsMutation returns true if the operation is a mutation | ||
IsMutation() bool | ||
// IsIdempotent returns true if the operation is idempotent | ||
// This is used to determine if the operation can be retried in case of a | ||
// failure. | ||
IsIdempotent() bool | ||
// IsLightweight returns true if the operation is lightweight | ||
// The lightweight operations are the ones that either modify the metadata or | ||
// drop the delete from disk as opposed to the ones that re-write the whole | ||
// data parts. | ||
IsLightweight() bool | ||
|
||
// OnCluster returns a new operation with the cluster name set | ||
// This is used when the operation is run on a specific cluster | ||
OnCluster(string) Operation | ||
|
||
// WithReplication returns a new operation with the replication set | ||
WithReplication() Operation | ||
|
||
// ShouldWaitForDistributionQueue returns true if the operation should wait for the distribution queue to be empty | ||
ShouldWaitForDistributionQueue() (bool, string, string) | ||
} |