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

DRY kv/set #2319

Merged
merged 9 commits into from
Sep 17, 2024
Merged

DRY kv/set #2319

merged 9 commits into from
Sep 17, 2024

Conversation

corrideat
Copy link
Member

@corrideat corrideat commented Aug 25, 2024

Closes #2289

Copy link

cypress bot commented Sep 7, 2024

group-income    Run #3152

Run Properties:  status check passed Passed #3152  •  git commit 4431b574d9 ℹ️: Merge 13c390ff6c12bab614f4d4fddf83b72993d77632 into c93398fe79ee6bdf2b9b66def7bc...
Project group-income
Branch Review feature/2289-dry-kv-set
Run status status check passed Passed #3152
Run duration 09m 09s
Commit git commit 4431b574d9 ℹ️: Merge 13c390ff6c12bab614f4d4fddf83b72993d77632 into c93398fe79ee6bdf2b9b66def7bc...
Committer Ricardo Iván Vieitez Parra
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 10
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 111
View all changes introduced in this branch ↗︎

Copy link
Member

@taoeffect taoeffect left a comment

Choose a reason for hiding this comment

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

Nice work @corrideat!

One slight change request:

frontend/controller/actions/index.js Outdated Show resolved Hide resolved
@corrideat corrideat marked this pull request as ready for review September 13, 2024 16:21
Copy link
Member

@taoeffect taoeffect left a comment

Choose a reason for hiding this comment

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

Minor organizational and comment-related change request

Comment on lines +4 to +12
'chelonia/kv/queuedSet': ({ contractID, key, data, onconflict, encryptionKeyName = 'cek', signingKeyName = 'csk' }) => {
return sbp('chelonia/queueInvocation', contractID, () => {
return sbp('chelonia/kv/set', contractID, key, data, {
encryptionKeyId: sbp('chelonia/contract/currentKeyIdByName', contractID, encryptionKeyName),
signingKeyId: sbp('chelonia/contract/currentKeyIdByName', contractID, signingKeyName),
onconflict
})
})
}
Copy link
Member

Choose a reason for hiding this comment

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

Request:

  • could be this placed next to the the existing selector 'chelonia/kv/set' so that it's easier to see?
  • could you please add a comment above it explaining why usually calling this version is preferred and what this queueing accomplishes?

Copy link
Member Author

Choose a reason for hiding this comment

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

could be this placed next to the the existing selector 'chelonia/kv/set' so that it's easier to see?

I think chelonia.js is already cluttered as it is. The reason for putting this in a different file is also that IMHO this belongs in a possibly optional library as it makes some assumptions about which keys are defined (i.e., the csk and the cek) which isn't done in Chelonia currently.

When encryptedAction is moved into Chelonia, it would also be placed in this new file, because it also is a 'suggested' way of doing a common action, but not something that applies to all situations.

Could you please add a comment above it explaining why usually calling this version is preferred

Sure, although calling this version isn't 'preferred', just less much verbose in a common situation. I can explain that.

Copy link
Member

Choose a reason for hiding this comment

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

Sure, if you want to leave it in that file, then please add a comment above 'chelonia/kv/set' to tell people to look at 'chelonia/kv/queuedSet' which is preferable (and where to find that).

Copy link
Member

@taoeffect taoeffect left a comment

Choose a reason for hiding this comment

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

Beautiful!

@taoeffect taoeffect merged commit e03e16b into master Sep 17, 2024
4 checks passed
@taoeffect taoeffect deleted the feature/2289-dry-kv-set branch September 17, 2024 20:21
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.

DRY: 'chelonia/kv/set' should always use 'chelonia/queueInvocation'
2 participants