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

Isolate clients and documents for each project #319

Merged
merged 2 commits into from
May 4, 2022
Merged

Conversation

hackerwins
Copy link
Member

@hackerwins hackerwins commented May 3, 2022

What this PR does / why we need it:

Isolate clients and documents for each project

  • Add ProjectID to in DocInfo and ClientInfo.
  • It is not compatible with the existing MongoDB and the migration script was not written as it was pre-deployment.
  • Keys for clients and documents are unique for each project rather than a system global.
  • The logic to check whether the Document and Client belong to the Project is in the database layer.

This PR also cleans up codes

  • Rename db package to database
  • Extract Paging
  • Move project logic to projects package
  • Remove unused codes

Which issue(s) this PR fixes:

Fixes #310

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

@codecov
Copy link

codecov bot commented May 4, 2022

Codecov Report

Merging #319 (2fc43f6) into main (149693a) will decrease coverage by 0.52%.
The diff coverage is 44.11%.

@@            Coverage Diff             @@
##             main     #319      +/-   ##
==========================================
- Coverage   46.76%   46.24%   -0.53%     
==========================================
  Files          58       62       +4     
  Lines        5061     5173     +112     
==========================================
+ Hits         2367     2392      +25     
- Misses       2439     2521      +82     
- Partials      255      260       +5     
Impacted Files Coverage Δ
server/backend/backend.go 0.00% <0.00%> (ø)
server/backend/database/change_info.go 29.16% <ø> (ø)
server/backend/database/client_info.go 35.59% <0.00%> (ø)
server/backend/database/doc_info.go 0.00% <0.00%> (ø)
server/backend/database/mongo/client.go 0.00% <0.00%> (ø)
server/backend/database/mongo/config.go 61.90% <ø> (ø)
server/backend/database/mongo/encoder.go 0.00% <ø> (ø)
server/backend/database/mongo/indexes.go 0.00% <ø> (ø)
server/backend/database/mongo/registry.go 100.00% <ø> (ø)
server/backend/database/project_info.go 8.82% <ø> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 149693a...2fc43f6. Read the comment docs.

- Extract Paging
- Move project logic to projects
- Remove unused codes
@hackerwins hackerwins force-pushed the project-api branch 2 times, most recently from 80e2473 to 354e0d9 Compare May 4, 2022 04:24
@hackerwins hackerwins marked this pull request as ready for review May 4, 2022 04:28
@hackerwins hackerwins requested a review from a team May 4, 2022 04:28
@hackerwins hackerwins changed the title Apply project concept to Document, Client API Isolate clients and documents for each project May 4, 2022
Keys for clients and documents are unique for each project rather than
system global.
@hackerwins hackerwins merged commit 6e09e95 into main May 4, 2022
@hackerwins hackerwins deleted the project-api branch May 4, 2022 07:58
jeonjonghyeok pushed a commit to jeonjonghyeok/yorkie that referenced this pull request Aug 4, 2022
To isolate clients and documents for each project this commit added
`ProjectID` to `DocInfo` and `ClientInfo`. The logic to check whether
the Document and Client belong to the Project is in the database layer.

And keys for clients and documents are unique for each project rather
than a system global. This is to allow users to manage keys by their
projects.

It is not compatible with the existing MongoDB and the migration script
was not written as it was pre-deployment.

This commit also cleans up codes:

- Rename `db` package to `database`
- Extract Paging
- Move project logic to `projects` package
- Remove unused codes
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 multi-tenancy
1 participant