feat(entities) Adds change provider entity and mysql backed store for it#44
Conversation
| @@ -0,0 +1,19 @@ | |||
| package entity | |||
|
|
|||
| type ChangeProvider struct { | |||
There was a problem hiding this comment.
plz comment the struct itself
| ID string | ||
| // Queue is the name of the queue processing the land request. | ||
| // This is defined in the configuration and should be unique within the system. | ||
| Queue string |
There was a problem hiding this comment.
probably not needed here
| ChangeProviderID string | ||
| // Metadata is the interesting data from the change provider that we want to store. | ||
| // This is a freeform JSON object. | ||
| Metadata map[string]any |
There was a problem hiding this comment.
may be [string]string to avoid ambiguity at the storage level and conversion errors?
| Metadata map[string]any | ||
| // 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 |
There was a problem hiding this comment.
ok to keep for now, not sure if we expect changes to this? I thought it should be fully immutable, unless we want to update data from the PRs periodically...
There was a problem hiding this comment.
I removed this - version is not needed for this entity.
| @@ -0,0 +1,9 @@ | |||
| CREATE TABLE IF NOT EXISTS change_provider ( | |||
| id VARCHAR(255) NOT NULL, | |||
| queue VARCHAR(255) NOT NULL, | |||
There was a problem hiding this comment.
queue is likely not needed, we have request id incorporating it
| } | ||
|
|
||
| // Create creates a new change provider from a request. Returns ErrAlreadyExists if the entry already exists. | ||
| func (s *changeProviderStore) Create(ctx context.Context, request entity.Request) error { |
There was a problem hiding this comment.
I suggest to make ChangeProvider entity created by the app layer, and db layer is only to store or retrieve
There was a problem hiding this comment.
I have changed this signature already.
| Get(ctx context.Context, id string) (entity.ChangeProvider, error) | ||
|
|
||
| // Create creates a new change provider. | ||
| Create(ctx context.Context, request entity.Request) error |
There was a problem hiding this comment.
ditto on above, storage layer store should in general not be aware of any entity other than the one it materializes.
There was a problem hiding this comment.
I have changed this signature already.
| return &changeProviderStore{db: db} | ||
| } | ||
|
|
||
| // Get retrieves a change provider by ID. Returns ErrNotFound if the change provider is not found. |
There was a problem hiding this comment.
I guess it needs to retrieve all of the changes associated with the request? Also in the order specified in the request.
There was a problem hiding this comment.
So it has to be an array or a separate entity
| @@ -0,0 +1,7 @@ | |||
| CREATE TABLE IF NOT EXISTS change_provider ( | |||
| id VARCHAR(255) NOT NULL, | |||
There was a problem hiding this comment.
maybe we call it request_id
There was a problem hiding this comment.
sqid :)
also in the Requests table :)
| // to be the same as the request to which it belongs. The caller is repsonsible | ||
| // for inspecting and mapping the result of this function to the | ||
| // order of changes within the original request. | ||
| // |
## Summary feat(entities) Adds batch entity and batch sql schema ## Why? <!-- Why is this change necessary? What is the motivation or justification? --> This sets up batch entity and its corresponding sql schema. This establishes the core concept of a batch that will be used through the system. ## What? * Add a `Batch` entity * Add `batch` mysql schema * Note: `BatchStore` in upcoming PR ## Test Plan ## Issues ## Stack 1. #44 1. @ #46 1. #47 1. #48 1. #49
## 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. #44 1. #46 1. @ #47 1. #48 1. #49
|
It seems that the comment about retrieveing an array of changes (or at least change ids) was not addressed? |
Summary
feat(entities) Adds change provider entity and mysql backed store for it
Why?
This sets up change provider entity and its corresponding sql store. This will be used by various workflows in the orchestrator to get information about changes going through the system.
What?
ChangeProviderentityChangeProviderStore- the mysql store that backs this entityTest Plan
Issues
Stack