- Notifications
You must be signed in to change notification settings - Fork 0
파티셔닝시 CanonicalOperation 을 blob object 로 리턴하도록 수정#23
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
toothlessdev
merged 3 commits into
develop
from
22-implement-partitioning-logic-to-save-blob-to-external-storageJan 30, 2026
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76 packages/patchlogr-core/src/partition/__tests__/partitionByMethod.test.ts
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
76 changes: 76 additions & 0 deletions
76 packages/patchlogr-core/src/partition/__tests__/partitionByTag.test.ts
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 |
|---|---|---|
| @@ -112,4 +112,80 @@ describe("partitionByTag", () => { | ||
| expect(defaultTagNode?.children).toHaveLength(1); | ||
| expect(defaultTagNode?.children?.[0]?.key).toBe("GET /user"); | ||
| }); | ||
| test("hashObjects를 리턴한다", () => { | ||
| const spec: CanonicalSpec = { | ||
| operations: { | ||
| "GET /user": { | ||
| key: "GET /user", | ||
| doc: { tags: ["user"] }, | ||
| method: "GET", | ||
| path: "/user", | ||
| request: { params: [] }, | ||
| responses: {}, | ||
| }, | ||
| "POST /user": { | ||
| key: "POST /user", | ||
| doc: { tags: ["user"] }, | ||
| method: "POST", | ||
| path: "/user", | ||
| request: { params: [] }, | ||
| responses: {}, | ||
| }, | ||
| }, | ||
| }; | ||
| const result = partitionByTag(spec); | ||
| expect(result.hashObjects).toBeDefined(); | ||
| expect(result.hashObjects).toHaveLength(2); | ||
| }); | ||
toothlessdev marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| test("리프노드에는 value가 포함되지 않는다", () => { | ||
| const spec: CanonicalSpec = { | ||
| operations: { | ||
| "GET /user": { | ||
| key: "GET /user", | ||
| doc: { tags: ["user"] }, | ||
| method: "GET", | ||
| path: "/user", | ||
| request: { params: [] }, | ||
| responses: {}, | ||
| }, | ||
| }, | ||
| }; | ||
| const result = partitionByTag(spec); | ||
| const leafNode = result.root.children?.[0]?.children?.[0]; | ||
| expect(leafNode?.type).toBe("leaf"); | ||
| expect(leafNode?.hash).toBeDefined(); | ||
| expect(leafNode?.value).toBeUndefined(); | ||
| }); | ||
| test("hashObjects에 리프노드에 대한 CanonicalOperation 이 매핑된다", () => { | ||
| const operation = { | ||
| key: "GET /user" as const, | ||
| doc: { tags: ["user"] }, | ||
| method: "GET" as const, | ||
| path: "/user", | ||
| request: { params: [] }, | ||
| responses: {}, | ||
| }; | ||
| const spec: CanonicalSpec = { | ||
| operations: { | ||
| "GET /user": operation, | ||
| }, | ||
| }; | ||
| const result = partitionByTag(spec); | ||
| const leafNode = result.root.children?.[0]?.children?.[0]; | ||
| const hashObject = result.hashObjects.find( | ||
| (ho) => ho.hash === leafNode?.hash, | ||
| ); | ||
| expect(hashObject).toBeDefined(); | ||
| expect(hashObject?.data).toEqual(operation); | ||
| }); | ||
| }); | ||
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
22 changes: 15 additions & 7 deletions
22 packages/patchlogr-core/src/partition/partitionByMethod.ts
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
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
5 changes: 0 additions & 5 deletions
5 ...patchlogr-core/src/partition/partition.ts → ...logr-core/src/partition/types/hashNode.ts
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
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,4 @@ | ||
| export type HashObject<T> = { | ||
| hash: string; | ||
| data: T; | ||
| }; |
8 changes: 8 additions & 0 deletions
8 packages/patchlogr-core/src/partition/types/partitionedSpec.ts
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,8 @@ | ||
| import type { HashNode } from "./hashNode"; | ||
| import type { HashObject } from "./hashObject"; | ||
| export type PartitionedSpec<K = string, V = unknown> = { | ||
| root: HashNode<K, V>; | ||
| metadata: Record<string, unknown>; | ||
| hashObjects: HashObject<V>[]; | ||
| }; |
4 changes: 2 additions & 2 deletions
4 ...atchlogr-core/src/partition/createNode.ts → ...gr-core/src/partition/utils/createNode.ts
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
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.