-
Notifications
You must be signed in to change notification settings - Fork 19
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
chore: Add initial documentation. #263
Merged
kinyoklion
merged 4 commits into
feat/node-migrations
from
rlamb/migration-docs-first-pass
Aug 30, 2023
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ebd9a98
doc: Add initial documentation.
kinyoklion aca009d
Additional documentation.
kinyoklion 81e00d4
Better migration variation documentation.
kinyoklion 1328803
Merge branch 'feat/node-migrations' into rlamb/migration-docs-first-pass
kinyoklion 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 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
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
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
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
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
34 changes: 34 additions & 0 deletions
34
packages/shared/sdk-server/src/api/data/LDMigrationStage.ts
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 |
---|---|---|
@@ -1,12 +1,46 @@ | ||
/** | ||
* Stage denotes one of six possible stages a technology migration could be a | ||
* part of, progressing through the following order. | ||
* | ||
* Off -> DualWrite -> Shadow -> Live -> RampDown -> Complete | ||
*/ | ||
export enum LDMigrationStage { | ||
/** | ||
* Off - migration hasn't started, "old" is authoritative for reads and writes | ||
*/ | ||
Off = 'off', | ||
|
||
/** | ||
* DualWrite - write to both "old" and "new", "old" is authoritative for reads | ||
*/ | ||
DualWrite = 'dualwrite', | ||
|
||
/** | ||
* Shadow - both "new" and "old" versions run with a preference for "old" | ||
*/ | ||
Shadow = 'shadow', | ||
|
||
/** | ||
* Live - both "new" and "old" versions run with a preference for "new" | ||
*/ | ||
Live = 'live', | ||
|
||
/** | ||
* RampDown - only read from "new", write to "old" and "new" | ||
*/ | ||
RampDown = 'rampdown', | ||
|
||
/** | ||
* Complete - migration is done | ||
*/ | ||
Complete = 'complete', | ||
} | ||
|
||
/** | ||
* Check if the given string is a migration stage. | ||
* @param value The string to check. | ||
* @returns True if the string is a migration stage. | ||
*/ | ||
export function IsMigrationStage(value: string): boolean { | ||
return Object.values(LDMigrationStage).includes(value as LDMigrationStage); | ||
} |
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 |
---|---|---|
|
@@ -90,27 +90,69 @@ export interface LDMigrationOptions< | |
errorTracking?: boolean; | ||
|
||
/** | ||
* TKTK | ||
* Implementation which provides a read from the "new" source. | ||
* | ||
* Users are required to provide two different read methods -- one to read from the old migration source, and one to | ||
* read from the new source. Additionally, customers can opt-in to consistency tracking by providing a `check` | ||
* function. | ||
* | ||
* Depending on the migration stage, one or both of these read methods may be called. | ||
* | ||
* Throwing an exception from this method will be treated as an error. | ||
* | ||
* @param payload An optional payload. The payload is provided when calling the `read` method on the migration. | ||
* @returns The result of the operation. Use {@link LDMigrationSuccess} or {@link LDMigrationError} to create a suitable return value. | ||
*/ | ||
readNew: (payload?: TMigrationReadInput) => Promise<LDMethodResult<TMigrationRead>>; | ||
|
||
/** | ||
* TKTK | ||
* Implementation which provides a write to the "new" source. | ||
* | ||
* Users are required to provide two different write methods -- one to write to the old migration source, and one to | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a bit of duplication here, again because it makes finding the information a bit easier. |
||
* write to the new source. Not every stage requires | ||
* | ||
* | ||
* Depending on the migration stage, one or both of these write methods may be called. | ||
* | ||
* Throwing an exception from this method will be treated as an error. | ||
* | ||
* @param payload An optional payload. The payload is provided when calling the `read` method on the migration. | ||
* @returns The result of the operation. Use {@link LDMigrationSuccess} or {@link LDMigrationError} to create a suitable return value. | ||
*/ | ||
writeNew: (payload?: TMigrationWriteInput) => Promise<LDMethodResult<TMigrationWrite>>; | ||
|
||
/** | ||
* TKTK | ||
* Implementation which provides a read from the "old" source. | ||
* | ||
* Users are required to provide two different read methods -- one to read from the old migration source, and one to | ||
* read from the new source. Additionally, customers can opt-in to consistency tracking by providing a `check` | ||
* function. | ||
* | ||
* Depending on the migration stage, one or both of these read methods may be called. | ||
* | ||
* Throwing an exception from this method will be treated as an error. | ||
* | ||
*/ | ||
readOld: (payload?: TMigrationReadInput) => Promise<LDMethodResult<TMigrationRead>>; | ||
|
||
/** | ||
* TKTK | ||
* Implementation which provides a write to the "old" source. | ||
* | ||
* Users are required to provide two different write methods -- one to write to the old migration source, and one to | ||
* write to the new source. Not every stage requires | ||
* | ||
* Depending on the migration stage, one or both of these write methods may be called. | ||
* | ||
* Throwing an exception from this method will be treated as an error. | ||
* | ||
* @param payload An optional payload. The payload is provided when calling the `read` method on the migration. | ||
* @returns The result of the operation. Use {@link LDMigrationSuccess} or {@link LDMigrationError} to create a suitable return value. | ||
*/ | ||
writeOld: (payload?: TMigrationWriteInput) => Promise<LDMethodResult<TMigrationWrite>>; | ||
|
||
/** | ||
* TKTK | ||
* Method used to do consistency checks for read operations. After a read operation, during which both data sources | ||
* are read from, a check of read consistency may be done using this method. | ||
*/ | ||
check?: (a: TMigrationRead, b: TMigrationRead) => boolean; | ||
} |
Oops, something went wrong.
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.
This is the same sample, but I think it makes things easier for customers.