Skip to content

Commit 8ec2c45

Browse files
authored
feat(entities) Adds batch dependent entity and sql schema (#54)
## Summary feat(entities) Adds batch dependent entity and sql schema ## Why? <!-- Why is this change necessary? What is the motivation or justification? --> This sets up batch dependent entity and its corresponding sql schema. This helps make reverse look ups for batch dependencies easier throughout the system. ## What? * Add a `BatchDependent` entity * Add `batch_dependent` mysql schema * Note: `BatchDependentStore` in upcoming PR ## Test Plan ## Issues ## Stack 1. @ #54 1. #48 1. #49 1. #56
1 parent c88fd48 commit 8ec2c45

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

entity/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go_library(
44
name = "entity",
55
srcs = [
66
"batch.go",
7+
"batch_dependent.go",
78
"change_provider.go",
89
"request.go",
910
],

entity/batch_dependent.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package entity
2+
3+
// BatchDependent represents the downstream batches that depend on a given batch.
4+
// The object is immutable after creation.
5+
type BatchDependent struct {
6+
// BatchID is the globally unique identifier representing a batch.
7+
BatchID string
8+
// Dependents is a list of batch IDs that are dependents for this
9+
// batch.
10+
//
11+
// For e.g - Consider batches - queueA/batch/1, queueA/batch/2, queueA/batch/3
12+
// such that - queueA/batch/2 and queueA/batch/3 depend on queueA/batch/1
13+
//
14+
// In this case, the Dependents field for -
15+
// - queueA/batch/1 will be [queueA/batch/2, queueA/batch/3]
16+
// - queueA/batch/2 will be empty
17+
// - queueA/batch/3 will be empty
18+
//
19+
Dependents []string
20+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CREATE TABLE IF NOT EXISTS batch_dependent (
2+
batch_id VARCHAR(255) NOT NULL,
3+
dependents JSON NOT NULL,
4+
PRIMARY KEY (batch_id)
5+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

0 commit comments

Comments
 (0)