-
Notifications
You must be signed in to change notification settings - Fork 0
feat(entities) Adds batch entity and batch sql schema #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,41 @@ | ||
| package entity | ||
|
|
||
| // BatchState defines the possible states of a batch. | ||
| type BatchState string | ||
|
|
||
| const ( | ||
| // BatchStateUnknown is the unreachable state. It is set by default when the structure is initialized. It should never be seen in the system. | ||
| BatchStateUnknown BatchState = "" | ||
| // TODO: Add comprehensive list of known batch states. | ||
| ) | ||
|
|
||
| // Batch represents a group of requests to land (merge into target branch of the source control repository). | ||
| type Batch struct { | ||
| // ID is the globally unique identifier for the batch. Format: "<queue>/batch/<counter_value>". | ||
| ID string | ||
| // Queue is the name of the queue processing the land request. Queue name is defined in the configuration and should be unique within the system. | ||
| Queue string | ||
| // Contains is a list of land request IDs that are part of this batch. | ||
| // Request IDs will always be part of the same queue. | ||
| // | ||
| // For e.g. - [queueA/1, queueA/2, queueA/3]. | ||
| // | ||
| Contains []string | ||
| // Dependencies is a list of batch IDs (and associated metadata) for this batch. | ||
| // Dependencies will always be part of the same queue. | ||
| // | ||
| // For e.g - Consider batches - queueA/batch/1, queueA/batch/2, queueA/batch/3 | ||
| // such that - queueA/batch/2 and queueA/batch/3 depend on queueA/batch/1 | ||
| // | ||
| // In this case, the Dependencies field for - | ||
| // - queueA/batch/1 will be empty | ||
| // - queueA/batch/2 will contain queueA/batch/1 | ||
| // - queueA/batch/3 will contain queueA/batch/1 | ||
| // | ||
| Dependencies []map[string]interface{} | ||
| // The state of the batch lifecycle this batch is in. | ||
| State BatchState | ||
| // Version is the version of the object. It is used for optimistic locking. | ||
| // Versioning starts at 1 and is incremented for each change to the object. | ||
| Version int32 | ||
| } | ||
This file contains hidden or 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,9 @@ | ||
| CREATE TABLE IF NOT EXISTS batch ( | ||
| id VARCHAR(255) NOT NULL, | ||
| queue VARCHAR(255) NOT NULL, | ||
| contains JSON NOT NULL, | ||
| dependencies JSON NOT NULL, | ||
| state VARCHAR(255) NOT NUll, | ||
| version INT NOT NULL, | ||
| PRIMARY KEY (id) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be need a more thorough explanation what deps are
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated