Skip to content
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

Add GetDocuments API returning document summaries #909

Merged
merged 2 commits into from
Jun 28, 2024
Merged

Conversation

hackerwins
Copy link
Member

@hackerwins hackerwins commented Jun 28, 2024

What this PR does / why we need it:

Add GetDocuments API returning document summaries

Which issue(s) this PR fixes:

Fixes #823

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


Additional documentation:


Checklist:

  • Added relevant tests or not required
  • Didn't break anything

Summary by CodeRabbit

  • New Features

    • Introduced GetDocuments RPC method in AdminService to retrieve multiple documents based on project name and document keys.
    • Added a new function GetDocumentSummaries to return a list of document summaries.
  • Bug Fixes

    • Improved project retrieval in DeactivateClient method by utilizing the new DefaultProject method.
  • Refactor

    • Updated descriptions and URLs in the OpenAPI YAML files for better consistency and accuracy.
    • Updated the TestDocKey function signature to accept an additional variadic parameter for enhanced testing flexibility.
  • Tests

    • Added test functions for REST API interactions, including single and bulk document retrieval, in the new restapi_test.go file.

Copy link

coderabbitai bot commented Jun 28, 2024

Walkthrough

The changes include updates and enhancements to the Yorkie project, optimizing API documentation and adding features such as a Bulk GET REST API for retrieving multiple documents. Several formatting corrections in YAML files were made, new methods were introduced in admin.proto and corresponding Go files, and new functionalities were created for handling projects and documents within server files.

Changes

File(s) Change Summary
api/docs/yorkie/v1/resources.openapi.yaml Minor formatting, quotation changes, and URL updates.
api/docs/yorkie/v1/yorkie.openapi.yaml Description updates and URLs for server modifications.
api/yorkie/v1/admin.proto Added GetDocuments RPC method along with corresponding request and response message types.
api/yorkie/v1/v1connect/admin.connect.go Introduced GetDocuments method to AdminServiceClient and associated handling mechanisms.
server/documents/documents.go Added GetDocumentSummaries function to return a list of document summaries.
server/rpc/admin_server.go Added GetDocuments function to interact with project and document entities to retrieve documents based on specified keys.
server/server.go Modified DeactivateClient method to use DefaultProject, added DefaultProject and CreateProject methods for handling projects.
test/helper/helper.go Updated TestDocKey function to accept an additional variadic parameter prefix ...int.
test/integration/restapi_test.go Added test functions for REST API interactions related to document retrieval including single, bulk, and listing documents.

Sequence Diagram(s)

sequenceDiagram
    actor User
    user ->> AdminService: GetBulkDocumentsRequest
    AdminService ->> ProjectManager: RetrieveProject(projectName)
    ProjectManager -->> AdminService: Project
    AdminService ->> DocumentStore: FetchDocuments(project, documentKeys)
    DocumentStore -->> AdminService: List of Documents
    AdminService -->> user: GetBulkDocumentsResponse
Loading

Assessment against linked issues

Objective (Issue #823) Addressed Explanation
Introduce Bulk GET REST API for retrieving multiple documents (#823)
Optimize the process of retrieving document information
Ensure reduced number of API calls
Implement the described request and response formats

In code where data dances swift,
We send requests, responses drift.
Bulk documents gather in a line,
Streamlined access, so divine!
Yorkie's APIs now, robust and clean,
In the world of bytes, they reign supreme.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go Benchmark

Benchmark suite Current: 5a1d1fd Previous: a61112a Ratio
BenchmarkDocument/constructor_test 1594 ns/op 1337 B/op 24 allocs/op 1533 ns/op 1337 B/op 24 allocs/op 1.04
BenchmarkDocument/constructor_test - ns/op 1594 ns/op 1533 ns/op 1.04
BenchmarkDocument/constructor_test - B/op 1337 B/op 1337 B/op 1
BenchmarkDocument/constructor_test - allocs/op 24 allocs/op 24 allocs/op 1
BenchmarkDocument/status_test 941.3 ns/op 1305 B/op 22 allocs/op 965.6 ns/op 1305 B/op 22 allocs/op 0.97
BenchmarkDocument/status_test - ns/op 941.3 ns/op 965.6 ns/op 0.97
BenchmarkDocument/status_test - B/op 1305 B/op 1305 B/op 1
BenchmarkDocument/status_test - allocs/op 22 allocs/op 22 allocs/op 1
BenchmarkDocument/equals_test 7712 ns/op 7273 B/op 132 allocs/op 8700 ns/op 7273 B/op 132 allocs/op 0.89
BenchmarkDocument/equals_test - ns/op 7712 ns/op 8700 ns/op 0.89
BenchmarkDocument/equals_test - B/op 7273 B/op 7273 B/op 1
BenchmarkDocument/equals_test - allocs/op 132 allocs/op 132 allocs/op 1
BenchmarkDocument/nested_update_test 16982 ns/op 12139 B/op 262 allocs/op 16792 ns/op 12138 B/op 262 allocs/op 1.01
BenchmarkDocument/nested_update_test - ns/op 16982 ns/op 16792 ns/op 1.01
BenchmarkDocument/nested_update_test - B/op 12139 B/op 12138 B/op 1.00
BenchmarkDocument/nested_update_test - allocs/op 262 allocs/op 262 allocs/op 1
BenchmarkDocument/delete_test 22730 ns/op 15363 B/op 341 allocs/op 22590 ns/op 15363 B/op 341 allocs/op 1.01
BenchmarkDocument/delete_test - ns/op 22730 ns/op 22590 ns/op 1.01
BenchmarkDocument/delete_test - B/op 15363 B/op 15363 B/op 1
BenchmarkDocument/delete_test - allocs/op 341 allocs/op 341 allocs/op 1
BenchmarkDocument/object_test 8697 ns/op 6817 B/op 120 allocs/op 8624 ns/op 6817 B/op 120 allocs/op 1.01
BenchmarkDocument/object_test - ns/op 8697 ns/op 8624 ns/op 1.01
BenchmarkDocument/object_test - B/op 6817 B/op 6817 B/op 1
BenchmarkDocument/object_test - allocs/op 120 allocs/op 120 allocs/op 1
BenchmarkDocument/array_test 30169 ns/op 11947 B/op 276 allocs/op 29072 ns/op 11947 B/op 276 allocs/op 1.04
BenchmarkDocument/array_test - ns/op 30169 ns/op 29072 ns/op 1.04
BenchmarkDocument/array_test - B/op 11947 B/op 11947 B/op 1
BenchmarkDocument/array_test - allocs/op 276 allocs/op 276 allocs/op 1
BenchmarkDocument/text_test 33464 ns/op 14715 B/op 469 allocs/op 30623 ns/op 14716 B/op 469 allocs/op 1.09
BenchmarkDocument/text_test - ns/op 33464 ns/op 30623 ns/op 1.09
BenchmarkDocument/text_test - B/op 14715 B/op 14716 B/op 1.00
BenchmarkDocument/text_test - allocs/op 469 allocs/op 469 allocs/op 1
BenchmarkDocument/text_composition_test 29577 ns/op 18422 B/op 484 allocs/op 29036 ns/op 18422 B/op 484 allocs/op 1.02
BenchmarkDocument/text_composition_test - ns/op 29577 ns/op 29036 ns/op 1.02
BenchmarkDocument/text_composition_test - B/op 18422 B/op 18422 B/op 1
BenchmarkDocument/text_composition_test - allocs/op 484 allocs/op 484 allocs/op 1
BenchmarkDocument/rich_text_test 82360 ns/op 38476 B/op 1148 allocs/op 80904 ns/op 38477 B/op 1148 allocs/op 1.02
BenchmarkDocument/rich_text_test - ns/op 82360 ns/op 80904 ns/op 1.02
BenchmarkDocument/rich_text_test - B/op 38476 B/op 38477 B/op 1.00
BenchmarkDocument/rich_text_test - allocs/op 1148 allocs/op 1148 allocs/op 1
BenchmarkDocument/counter_test 17598 ns/op 10722 B/op 244 allocs/op 17291 ns/op 10722 B/op 244 allocs/op 1.02
BenchmarkDocument/counter_test - ns/op 17598 ns/op 17291 ns/op 1.02
BenchmarkDocument/counter_test - B/op 10722 B/op 10722 B/op 1
BenchmarkDocument/counter_test - allocs/op 244 allocs/op 244 allocs/op 1
BenchmarkDocument/text_edit_gc_100 1197300 ns/op 870798 B/op 16689 allocs/op 1180934 ns/op 870881 B/op 16689 allocs/op 1.01
BenchmarkDocument/text_edit_gc_100 - ns/op 1197300 ns/op 1180934 ns/op 1.01
BenchmarkDocument/text_edit_gc_100 - B/op 870798 B/op 870881 B/op 1.00
BenchmarkDocument/text_edit_gc_100 - allocs/op 16689 allocs/op 16689 allocs/op 1
BenchmarkDocument/text_edit_gc_1000 51232108 ns/op 50535909 B/op 181604 allocs/op 47886980 ns/op 50535996 B/op 181604 allocs/op 1.07
BenchmarkDocument/text_edit_gc_1000 - ns/op 51232108 ns/op 47886980 ns/op 1.07
BenchmarkDocument/text_edit_gc_1000 - B/op 50535909 B/op 50535996 B/op 1.00
BenchmarkDocument/text_edit_gc_1000 - allocs/op 181604 allocs/op 181604 allocs/op 1
BenchmarkDocument/text_split_gc_100 1829346 ns/op 1528728 B/op 15541 allocs/op 1785293 ns/op 1528671 B/op 15541 allocs/op 1.02
BenchmarkDocument/text_split_gc_100 - ns/op 1829346 ns/op 1785293 ns/op 1.02
BenchmarkDocument/text_split_gc_100 - B/op 1528728 B/op 1528671 B/op 1.00
BenchmarkDocument/text_split_gc_100 - allocs/op 15541 allocs/op 15541 allocs/op 1
BenchmarkDocument/text_split_gc_1000 119209611 ns/op 135075824 B/op 182088 allocs/op 113473840 ns/op 135076736 B/op 182089 allocs/op 1.05
BenchmarkDocument/text_split_gc_1000 - ns/op 119209611 ns/op 113473840 ns/op 1.05
BenchmarkDocument/text_split_gc_1000 - B/op 135075824 B/op 135076736 B/op 1.00
BenchmarkDocument/text_split_gc_1000 - allocs/op 182088 allocs/op 182089 allocs/op 1.00
BenchmarkDocument/text_delete_all_10000 18566909 ns/op 10182581 B/op 40673 allocs/op 16298898 ns/op 10185422 B/op 40675 allocs/op 1.14
BenchmarkDocument/text_delete_all_10000 - ns/op 18566909 ns/op 16298898 ns/op 1.14
BenchmarkDocument/text_delete_all_10000 - B/op 10182581 B/op 10185422 B/op 1.00
BenchmarkDocument/text_delete_all_10000 - allocs/op 40673 allocs/op 40675 allocs/op 1.00
BenchmarkDocument/text_delete_all_100000 345814795 ns/op 142684837 B/op 411724 allocs/op 289188448 ns/op 142668382 B/op 411686 allocs/op 1.20
BenchmarkDocument/text_delete_all_100000 - ns/op 345814795 ns/op 289188448 ns/op 1.20
BenchmarkDocument/text_delete_all_100000 - B/op 142684837 B/op 142668382 B/op 1.00
BenchmarkDocument/text_delete_all_100000 - allocs/op 411724 allocs/op 411686 allocs/op 1.00
BenchmarkDocument/text_100 219981 ns/op 120036 B/op 5081 allocs/op 227428 ns/op 120037 B/op 5081 allocs/op 0.97
BenchmarkDocument/text_100 - ns/op 219981 ns/op 227428 ns/op 0.97
BenchmarkDocument/text_100 - B/op 120036 B/op 120037 B/op 1.00
BenchmarkDocument/text_100 - allocs/op 5081 allocs/op 5081 allocs/op 1
BenchmarkDocument/text_1000 2404259 ns/op 1169024 B/op 50085 allocs/op 2422973 ns/op 1169024 B/op 50085 allocs/op 0.99
BenchmarkDocument/text_1000 - ns/op 2404259 ns/op 2422973 ns/op 0.99
BenchmarkDocument/text_1000 - B/op 1169024 B/op 1169024 B/op 1
BenchmarkDocument/text_1000 - allocs/op 50085 allocs/op 50085 allocs/op 1
BenchmarkDocument/array_1000 1241434 ns/op 1091354 B/op 11831 allocs/op 1253146 ns/op 1091486 B/op 11832 allocs/op 0.99
BenchmarkDocument/array_1000 - ns/op 1241434 ns/op 1253146 ns/op 0.99
BenchmarkDocument/array_1000 - B/op 1091354 B/op 1091486 B/op 1.00
BenchmarkDocument/array_1000 - allocs/op 11831 allocs/op 11832 allocs/op 1.00
BenchmarkDocument/array_10000 13443756 ns/op 9799690 B/op 120295 allocs/op 13174902 ns/op 9800095 B/op 120297 allocs/op 1.02
BenchmarkDocument/array_10000 - ns/op 13443756 ns/op 13174902 ns/op 1.02
BenchmarkDocument/array_10000 - B/op 9799690 B/op 9800095 B/op 1.00
BenchmarkDocument/array_10000 - allocs/op 120295 allocs/op 120297 allocs/op 1.00
BenchmarkDocument/array_gc_100 148828 ns/op 132725 B/op 1261 allocs/op 153323 ns/op 132725 B/op 1261 allocs/op 0.97
BenchmarkDocument/array_gc_100 - ns/op 148828 ns/op 153323 ns/op 0.97
BenchmarkDocument/array_gc_100 - B/op 132725 B/op 132725 B/op 1
BenchmarkDocument/array_gc_100 - allocs/op 1261 allocs/op 1261 allocs/op 1
BenchmarkDocument/array_gc_1000 1411954 ns/op 1159062 B/op 12876 allocs/op 1436361 ns/op 1159166 B/op 12876 allocs/op 0.98
BenchmarkDocument/array_gc_1000 - ns/op 1411954 ns/op 1436361 ns/op 0.98
BenchmarkDocument/array_gc_1000 - B/op 1159062 B/op 1159166 B/op 1.00
BenchmarkDocument/array_gc_1000 - allocs/op 12876 allocs/op 12876 allocs/op 1
BenchmarkDocument/counter_1000 200457 ns/op 193080 B/op 5771 allocs/op 210333 ns/op 193080 B/op 5771 allocs/op 0.95
BenchmarkDocument/counter_1000 - ns/op 200457 ns/op 210333 ns/op 0.95
BenchmarkDocument/counter_1000 - B/op 193080 B/op 193080 B/op 1
BenchmarkDocument/counter_1000 - allocs/op 5771 allocs/op 5771 allocs/op 1
BenchmarkDocument/counter_10000 2172079 ns/op 2087996 B/op 59778 allocs/op 2224656 ns/op 2088011 B/op 59778 allocs/op 0.98
BenchmarkDocument/counter_10000 - ns/op 2172079 ns/op 2224656 ns/op 0.98
BenchmarkDocument/counter_10000 - B/op 2087996 B/op 2088011 B/op 1.00
BenchmarkDocument/counter_10000 - allocs/op 59778 allocs/op 59778 allocs/op 1
BenchmarkDocument/object_1000 1403742 ns/op 1428122 B/op 9849 allocs/op 1438296 ns/op 1428305 B/op 9849 allocs/op 0.98
BenchmarkDocument/object_1000 - ns/op 1403742 ns/op 1438296 ns/op 0.98
BenchmarkDocument/object_1000 - B/op 1428122 B/op 1428305 B/op 1.00
BenchmarkDocument/object_1000 - allocs/op 9849 allocs/op 9849 allocs/op 1
BenchmarkDocument/object_10000 15734156 ns/op 12167945 B/op 100568 allocs/op 14996192 ns/op 12166057 B/op 100562 allocs/op 1.05
BenchmarkDocument/object_10000 - ns/op 15734156 ns/op 14996192 ns/op 1.05
BenchmarkDocument/object_10000 - B/op 12167945 B/op 12166057 B/op 1.00
BenchmarkDocument/object_10000 - allocs/op 100568 allocs/op 100562 allocs/op 1.00
BenchmarkDocument/tree_100 1057021 ns/op 943703 B/op 6101 allocs/op 1068352 ns/op 943710 B/op 6101 allocs/op 0.99
BenchmarkDocument/tree_100 - ns/op 1057021 ns/op 1068352 ns/op 0.99
BenchmarkDocument/tree_100 - B/op 943703 B/op 943710 B/op 1.00
BenchmarkDocument/tree_100 - allocs/op 6101 allocs/op 6101 allocs/op 1
BenchmarkDocument/tree_1000 78844103 ns/op 86460368 B/op 60115 allocs/op 77671373 ns/op 86460378 B/op 60114 allocs/op 1.02
BenchmarkDocument/tree_1000 - ns/op 78844103 ns/op 77671373 ns/op 1.02
BenchmarkDocument/tree_1000 - B/op 86460368 B/op 86460378 B/op 1.00
BenchmarkDocument/tree_1000 - allocs/op 60115 allocs/op 60114 allocs/op 1.00
BenchmarkDocument/tree_10000 9964291741 ns/op 8580666912 B/op 600200 allocs/op 9475398658 ns/op 8580983904 B/op 600247 allocs/op 1.05
BenchmarkDocument/tree_10000 - ns/op 9964291741 ns/op 9475398658 ns/op 1.05
BenchmarkDocument/tree_10000 - B/op 8580666912 B/op 8580983904 B/op 1.00
BenchmarkDocument/tree_10000 - allocs/op 600200 allocs/op 600247 allocs/op 1.00
BenchmarkDocument/tree_delete_all_1000 76272972 ns/op 87509900 B/op 75266 allocs/op 78992524 ns/op 87509566 B/op 75265 allocs/op 0.97
BenchmarkDocument/tree_delete_all_1000 - ns/op 76272972 ns/op 78992524 ns/op 0.97
BenchmarkDocument/tree_delete_all_1000 - B/op 87509900 B/op 87509566 B/op 1.00
BenchmarkDocument/tree_delete_all_1000 - allocs/op 75266 allocs/op 75265 allocs/op 1.00
BenchmarkDocument/tree_edit_gc_100 3819388 ns/op 4146762 B/op 15141 allocs/op 3878867 ns/op 4146782 B/op 15141 allocs/op 0.98
BenchmarkDocument/tree_edit_gc_100 - ns/op 3819388 ns/op 3878867 ns/op 0.98
BenchmarkDocument/tree_edit_gc_100 - B/op 4146762 B/op 4146782 B/op 1.00
BenchmarkDocument/tree_edit_gc_100 - allocs/op 15141 allocs/op 15141 allocs/op 1
BenchmarkDocument/tree_edit_gc_1000 306607631 ns/op 383745350 B/op 154848 allocs/op 321161747 ns/op 383745786 B/op 154848 allocs/op 0.95
BenchmarkDocument/tree_edit_gc_1000 - ns/op 306607631 ns/op 321161747 ns/op 0.95
BenchmarkDocument/tree_edit_gc_1000 - B/op 383745350 B/op 383745786 B/op 1.00
BenchmarkDocument/tree_edit_gc_1000 - allocs/op 154848 allocs/op 154848 allocs/op 1
BenchmarkDocument/tree_split_gc_100 2521131 ns/op 2412508 B/op 11125 allocs/op 2650861 ns/op 2412439 B/op 11125 allocs/op 0.95
BenchmarkDocument/tree_split_gc_100 - ns/op 2521131 ns/op 2650861 ns/op 0.95
BenchmarkDocument/tree_split_gc_100 - B/op 2412508 B/op 2412439 B/op 1.00
BenchmarkDocument/tree_split_gc_100 - allocs/op 11125 allocs/op 11125 allocs/op 1
BenchmarkDocument/tree_split_gc_1000 193041995 ns/op 222253834 B/op 121999 allocs/op 198365848 ns/op 222251406 B/op 121994 allocs/op 0.97
BenchmarkDocument/tree_split_gc_1000 - ns/op 193041995 ns/op 198365848 ns/op 0.97
BenchmarkDocument/tree_split_gc_1000 - B/op 222253834 B/op 222251406 B/op 1.00
BenchmarkDocument/tree_split_gc_1000 - allocs/op 121999 allocs/op 121994 allocs/op 1.00
BenchmarkRPC/client_to_server 391739404 ns/op 16821418 B/op 174516 allocs/op 374122388 ns/op 17100096 B/op 174492 allocs/op 1.05
BenchmarkRPC/client_to_server - ns/op 391739404 ns/op 374122388 ns/op 1.05
BenchmarkRPC/client_to_server - B/op 16821418 B/op 17100096 B/op 0.98
BenchmarkRPC/client_to_server - allocs/op 174516 allocs/op 174492 allocs/op 1.00
BenchmarkRPC/client_to_client_via_server 647202068 ns/op 34458140 B/op 319884 allocs/op 625891179 ns/op 31517376 B/op 319213 allocs/op 1.03
BenchmarkRPC/client_to_client_via_server - ns/op 647202068 ns/op 625891179 ns/op 1.03
BenchmarkRPC/client_to_client_via_server - B/op 34458140 B/op 31517376 B/op 1.09
BenchmarkRPC/client_to_client_via_server - allocs/op 319884 allocs/op 319213 allocs/op 1.00
BenchmarkRPC/attach_large_document 1380106932 ns/op 1895466504 B/op 8842 allocs/op 1299408449 ns/op 1919081232 B/op 8847 allocs/op 1.06
BenchmarkRPC/attach_large_document - ns/op 1380106932 ns/op 1299408449 ns/op 1.06
BenchmarkRPC/attach_large_document - B/op 1895466504 B/op 1919081232 B/op 0.99
BenchmarkRPC/attach_large_document - allocs/op 8842 allocs/op 8847 allocs/op 1.00
BenchmarkRPC/adminCli_to_server 562656518 ns/op 35992768 B/op 289560 allocs/op 544304254 ns/op 35939248 B/op 289516 allocs/op 1.03
BenchmarkRPC/adminCli_to_server - ns/op 562656518 ns/op 544304254 ns/op 1.03
BenchmarkRPC/adminCli_to_server - B/op 35992768 B/op 35939248 B/op 1.00
BenchmarkRPC/adminCli_to_server - allocs/op 289560 allocs/op 289516 allocs/op 1.00
BenchmarkLocker 63.59 ns/op 16 B/op 1 allocs/op 63.14 ns/op 16 B/op 1 allocs/op 1.01
BenchmarkLocker - ns/op 63.59 ns/op 63.14 ns/op 1.01
BenchmarkLocker - B/op 16 B/op 16 B/op 1
BenchmarkLocker - allocs/op 1 allocs/op 1 allocs/op 1
BenchmarkLockerParallel 39.6 ns/op 0 B/op 0 allocs/op 38.96 ns/op 0 B/op 0 allocs/op 1.02
BenchmarkLockerParallel - ns/op 39.6 ns/op 38.96 ns/op 1.02
BenchmarkLockerParallel - B/op 0 B/op 0 B/op 1
BenchmarkLockerParallel - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkLockerMoreKeys 149.1 ns/op 15 B/op 0 allocs/op 148.3 ns/op 15 B/op 0 allocs/op 1.01
BenchmarkLockerMoreKeys - ns/op 149.1 ns/op 148.3 ns/op 1.01
BenchmarkLockerMoreKeys - B/op 15 B/op 15 B/op 1
BenchmarkLockerMoreKeys - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkChange/Push_10_Changes 3984449 ns/op 121062 B/op 1284 allocs/op 3896870 ns/op 121573 B/op 1284 allocs/op 1.02
BenchmarkChange/Push_10_Changes - ns/op 3984449 ns/op 3896870 ns/op 1.02
BenchmarkChange/Push_10_Changes - B/op 121062 B/op 121573 B/op 1.00
BenchmarkChange/Push_10_Changes - allocs/op 1284 allocs/op 1284 allocs/op 1
BenchmarkChange/Push_100_Changes 14924513 ns/op 569246 B/op 6654 allocs/op 14558141 ns/op 573755 B/op 6654 allocs/op 1.03
BenchmarkChange/Push_100_Changes - ns/op 14924513 ns/op 14558141 ns/op 1.03
BenchmarkChange/Push_100_Changes - B/op 569246 B/op 573755 B/op 0.99
BenchmarkChange/Push_100_Changes - allocs/op 6654 allocs/op 6654 allocs/op 1
BenchmarkChange/Push_1000_Changes 118356850 ns/op 5299323 B/op 63151 allocs/op 116899857 ns/op 5458238 B/op 63153 allocs/op 1.01
BenchmarkChange/Push_1000_Changes - ns/op 118356850 ns/op 116899857 ns/op 1.01
BenchmarkChange/Push_1000_Changes - B/op 5299323 B/op 5458238 B/op 0.97
BenchmarkChange/Push_1000_Changes - allocs/op 63151 allocs/op 63153 allocs/op 1.00
BenchmarkChange/Pull_10_Changes 2966030 ns/op 100252 B/op 1004 allocs/op 2918150 ns/op 101057 B/op 1004 allocs/op 1.02
BenchmarkChange/Pull_10_Changes - ns/op 2966030 ns/op 2918150 ns/op 1.02
BenchmarkChange/Pull_10_Changes - B/op 100252 B/op 101057 B/op 0.99
BenchmarkChange/Pull_10_Changes - allocs/op 1004 allocs/op 1004 allocs/op 1
BenchmarkChange/Pull_100_Changes 4432396 ns/op 264713 B/op 3475 allocs/op 4336337 ns/op 266873 B/op 3475 allocs/op 1.02
BenchmarkChange/Pull_100_Changes - ns/op 4432396 ns/op 4336337 ns/op 1.02
BenchmarkChange/Pull_100_Changes - B/op 264713 B/op 266873 B/op 0.99
BenchmarkChange/Pull_100_Changes - allocs/op 3475 allocs/op 3475 allocs/op 1
BenchmarkChange/Pull_1000_Changes 9017187 ns/op 1492210 B/op 29855 allocs/op 8613255 ns/op 1493082 B/op 29855 allocs/op 1.05
BenchmarkChange/Pull_1000_Changes - ns/op 9017187 ns/op 8613255 ns/op 1.05
BenchmarkChange/Pull_1000_Changes - B/op 1492210 B/op 1493082 B/op 1.00
BenchmarkChange/Pull_1000_Changes - allocs/op 29855 allocs/op 29855 allocs/op 1
BenchmarkSnapshot/Push_3KB_snapshot 17345107 ns/op 708885 B/op 6658 allocs/op 16891728 ns/op 717487 B/op 6655 allocs/op 1.03
BenchmarkSnapshot/Push_3KB_snapshot - ns/op 17345107 ns/op 16891728 ns/op 1.03
BenchmarkSnapshot/Push_3KB_snapshot - B/op 708885 B/op 717487 B/op 0.99
BenchmarkSnapshot/Push_3KB_snapshot - allocs/op 6658 allocs/op 6655 allocs/op 1.00
BenchmarkSnapshot/Push_30KB_snapshot 121823094 ns/op 5608323 B/op 63173 allocs/op 119968864 ns/op 5690940 B/op 63160 allocs/op 1.02
BenchmarkSnapshot/Push_30KB_snapshot - ns/op 121823094 ns/op 119968864 ns/op 1.02
BenchmarkSnapshot/Push_30KB_snapshot - B/op 5608323 B/op 5690940 B/op 0.99
BenchmarkSnapshot/Push_30KB_snapshot - allocs/op 63173 allocs/op 63160 allocs/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot 6528916 ns/op 920704 B/op 15512 allocs/op 6416584 ns/op 923313 B/op 15512 allocs/op 1.02
BenchmarkSnapshot/Pull_3KB_snapshot - ns/op 6528916 ns/op 6416584 ns/op 1.02
BenchmarkSnapshot/Pull_3KB_snapshot - B/op 920704 B/op 923313 B/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - allocs/op 15512 allocs/op 15512 allocs/op 1
BenchmarkSnapshot/Pull_30KB_snapshot 16437510 ns/op 7154600 B/op 150104 allocs/op 15443248 ns/op 7158063 B/op 150114 allocs/op 1.06
BenchmarkSnapshot/Pull_30KB_snapshot - ns/op 16437510 ns/op 15443248 ns/op 1.06
BenchmarkSnapshot/Pull_30KB_snapshot - B/op 7154600 B/op 7158063 B/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot - allocs/op 150104 allocs/op 150114 allocs/op 1.00
BenchmarkSync/memory_sync_10_test 6919 ns/op 1286 B/op 38 allocs/op 6909 ns/op 1286 B/op 38 allocs/op 1.00
BenchmarkSync/memory_sync_10_test - ns/op 6919 ns/op 6909 ns/op 1.00
BenchmarkSync/memory_sync_10_test - B/op 1286 B/op 1286 B/op 1
BenchmarkSync/memory_sync_10_test - allocs/op 38 allocs/op 38 allocs/op 1
BenchmarkSync/memory_sync_100_test 51297 ns/op 8647 B/op 273 allocs/op 50661 ns/op 8644 B/op 273 allocs/op 1.01
BenchmarkSync/memory_sync_100_test - ns/op 51297 ns/op 50661 ns/op 1.01
BenchmarkSync/memory_sync_100_test - B/op 8647 B/op 8644 B/op 1.00
BenchmarkSync/memory_sync_100_test - allocs/op 273 allocs/op 273 allocs/op 1
BenchmarkSync/memory_sync_1000_test 590350 ns/op 74372 B/op 2122 allocs/op 578133 ns/op 74221 B/op 2115 allocs/op 1.02
BenchmarkSync/memory_sync_1000_test - ns/op 590350 ns/op 578133 ns/op 1.02
BenchmarkSync/memory_sync_1000_test - B/op 74372 B/op 74221 B/op 1.00
BenchmarkSync/memory_sync_1000_test - allocs/op 2122 allocs/op 2115 allocs/op 1.00
BenchmarkSync/memory_sync_10000_test 7914501 ns/op 738586 B/op 20314 allocs/op 7304011 ns/op 748058 B/op 20438 allocs/op 1.08
BenchmarkSync/memory_sync_10000_test - ns/op 7914501 ns/op 7304011 ns/op 1.08
BenchmarkSync/memory_sync_10000_test - B/op 738586 B/op 748058 B/op 0.99
BenchmarkSync/memory_sync_10000_test - allocs/op 20314 allocs/op 20438 allocs/op 0.99
BenchmarkTextEditing 5255621562 ns/op 3901955464 B/op 18743552 allocs/op 4962056883 ns/op 3901953416 B/op 18743554 allocs/op 1.06
BenchmarkTextEditing - ns/op 5255621562 ns/op 4962056883 ns/op 1.06
BenchmarkTextEditing - B/op 3901955464 B/op 3901953416 B/op 1.00
BenchmarkTextEditing - allocs/op 18743552 allocs/op 18743554 allocs/op 1.00

This comment was automatically generated by workflow using github-action-benchmark.

@hackerwins hackerwins marked this pull request as ready for review June 28, 2024 06:19
Copy link

codecov bot commented Jun 28, 2024

Codecov Report

Attention: Patch coverage is 0% with 31 lines in your changes missing coverage. Please review.

Project coverage is 50.57%. Comparing base (4226417) to head (5a1d1fd).

Files Patch % Lines
server/rpc/admin_server.go 0.00% 22 Missing ⚠️
server/server.go 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #909      +/-   ##
==========================================
- Coverage   50.72%   50.57%   -0.15%     
==========================================
  Files          70       70              
  Lines       10479    10509      +30     
==========================================
  Hits         5315     5315              
- Misses       4636     4666      +30     
  Partials      528      528              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4226417 and 5a1d1fd.

Files ignored due to path filters (1)
  • api/yorkie/v1/admin.pb.go is excluded by !**/*.pb.go
Files selected for processing (10)
  • api/docs/yorkie/v1/admin.openapi.yaml (54 hunks)
  • api/docs/yorkie/v1/resources.openapi.yaml (64 hunks)
  • api/docs/yorkie/v1/yorkie.openapi.yaml (49 hunks)
  • api/yorkie/v1/admin.proto (2 hunks)
  • api/yorkie/v1/v1connect/admin.connect.go (9 hunks)
  • server/documents/documents.go (1 hunks)
  • server/rpc/admin_server.go (1 hunks)
  • server/server.go (2 hunks)
  • test/helper/helper.go (1 hunks)
  • test/integration/restapi_test.go (1 hunks)
Files not summarized due to errors (1)
  • api/docs/yorkie/v1/admin.openapi.yaml: Error: Message exceeds token limit
Files skipped from review due to trivial changes (2)
  • api/docs/yorkie/v1/resources.openapi.yaml
  • api/docs/yorkie/v1/yorkie.openapi.yaml
Additional comments not posted (14)
api/yorkie/v1/admin.proto (3)

39-39: Addition of GetDocuments RPC Method

The new RPC method GetDocuments is correctly defined and follows the standard RPC declaration pattern used in this file. It aligns with the PR's goal to introduce a bulk document retrieval functionality.


117-120: Review of GetDocumentsRequest Message Definition

The GetDocumentsRequest message is well-structured, with fields for project_name and document_keys. This structure supports the functionality of retrieving multiple documents by their keys within a specific project, which is essential for the bulk retrieval feature.


122-124: Review of GetDocumentsResponse Message Definition

The GetDocumentsResponse message appropriately returns a list of DocumentSummary. This response structure is optimal for the intended use case of returning summaries of multiple documents, facilitating efficient data handling on the client side.

server/server.go (3)

139-141: Modification of DeactivateClient Method

The DeactivateClient method now utilizes the DefaultProject method to retrieve the project context, which is a cleaner and more modular approach than directly accessing the project retrieval logic. This change improves maintainability and reusability of the project retrieval functionality.


151-154: Introduction of DefaultProject Method

The new DefaultProject method centralizes the retrieval of the default project. This method enhances the modularity of the code and reduces duplication by centralizing project retrieval logic, which was previously directly used in multiple places.


156-164: Introduction of CreateProject Method

The CreateProject method effectively encapsulates the logic for creating a new project. It uses the DefaultProject method for initial project context retrieval, followed by the project creation logic. This method is well-structured and follows best practices in error handling and resource management.

test/integration/restapi_test.go (1)

48-118: Comprehensive REST API Integration Tests

The integration tests cover single document retrieval, bulk document retrieval, and list documents functionalities. The tests are well-structured, using assertions to validate the correctness of the API responses. These tests are crucial for ensuring the reliability and correctness of the new API functionalities.

server/rpc/admin_server.go (1)

207-235: New GetDocuments Method in adminServer

The GetDocuments method in adminServer correctly implements the logic for handling the new GetDocuments RPC call. It efficiently retrieves multiple document summaries based on the provided keys. The use of the converter.ToDocumentSummaries function ensures that the document summaries are correctly converted to the required format for the response.

test/helper/helper.go (1)

276-282: Approval of the modified TestDocKey function.

The addition of the variadic prefix parameter enhances the flexibility of key generation for tests, allowing customization of the document key based on the test requirements.

api/yorkie/v1/v1connect/admin.connect.go (1)

72-74: Approval of the GetDocuments RPC method implementation.

The addition of the GetDocuments method across various sections (declaration, client interface, client struct, handler interface, and HTTP handler) is consistent and correctly implements the new functionality as described in the PR. This method allows efficient retrieval of multiple document summaries, aligning with the PR's objectives to enhance API efficiency.

Also applies to: 99-99, 156-160, 194-194, 241-244, 276-276, 329-333, 372-373, 423-425

api/docs/yorkie/v1/admin.openapi.yaml (4)

37-48: New API Endpoint for GetDocuments is correctly defined

The addition of the new API endpoint /yorkie.v1.AdminService/GetDocuments is correctly implemented with appropriate request and response body references. This aligns well with the PR's objectives to introduce a Bulk GET API.


189-196: Correct linkage of request and response bodies for GetDocuments

The GetDocumentsRequest and GetDocumentsResponse are correctly linked in the API endpoint definition. The schema references match the definitions under components.

Also applies to: 316-323


418-436: Updated description for connect.error schema

The updated description for the connect.error schema is now more informative, providing a direct link to the documentation for error handling. This enhances clarity and usability of the API documentation.


17-20: Consistent updates to schema references

The updates to schema references throughout the document, changing from double quotes to single quotes, are consistent and correctly formatted. This enhances the readability and maintains the consistency of the YAML syntax.

Also applies to: 22-22, 24-24, 29-32, 34-34, 36-36, 41-44, 46-46, 48-48, 53-56, 58-58, 60-60, 65-68, 70-70, 72-72, 77-80, 82-82, 84-84, 89-92, 94-94, 96-96, 101-104, 106-106, 108-108, 113-116, 118-118, 120-120, 125-128, 130-130, 132-132, 137-140, 142-142, 144-144, 149-152, 154-154, 156-156, 161-164, 166-166, 168-168, 175-178, 184-188, 190-196, 202-205, 211-214, 220-223, 229-232, 238-241, 247-250, 256-259, 265-268, 274-277, 283-286, 293-296, 302-305, 311-315, 317-323, 329-332, 338-341, 347-350, 356-359, 365-368, 374-377, 383-386, 392-395, 401-404, 410-413, 557-557, 571-571, 576-576, 602-603, 609-610, 630-630, 642-642, 648-648, 669-669, 697-697, 704-735, 752-752, 777-778, 790-791, 806-806, 812-812, 818-818, 824-824, 859-860, 877-877, 922-922, 941-941, 984-984, 1001-1001, 1007-1007, 1013-1013, 1019-1019, 1025-1025, 1031-1031, 1037-1037, 1043-1043, 1049-1049, 1055-1055, 1067-1067, 1073-1073, 1079-1079, 1085-1085, 1112-1112, 1118-1118, 1124-1124, 1130-1130, 1163-1163, 1175-1175, 1181-1181, 1187-1187, 1199-1199, 1205-1205, 1211-1211, 1217-1217, 1229-1229, 1235-1235, 1241-1241, 1257-1257, 1263-1263, 1269-1269, 1275-1275, 1287-1287, 1298-1298, 1304-1304, 1326-1326, 1332-1332, 1338-1338, 1344-1344, 1377-1377, 1392-1392, 1402-1402, 1408-1408, 1414-1414, 1425-1425, 1442-1442, 1471-1471, 1477-1477, 1483-1483, 1489-1489, 1522-1522, 1561-1561, 1567-1567, 1576-1583, 1608-1608, 1634-1634, 1696-1696, 1728-1728, 1740-1740, 1776-1777, 1796-1796, 1802-1802, 1808-1808, 1814-1814, 1841-1841, 1853-1853, 1873-1873, 1884-1884, 1890-1890, 1902-1902, 1908-1908, 1914-1914, 1920-1920, 1945-1945, 1962-1962, 1974-1974, 1994-2021, 2030-2030, 2032-2033

server/documents/documents.go Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce Bulk GET REST API for retrieving multiple documents at once
1 participant