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

Is there a way to retrieve the CAS from the document? #652

Open
xavierchow opened this issue Apr 24, 2022 · 7 comments
Open

Is there a way to retrieve the CAS from the document? #652

xavierchow opened this issue Apr 24, 2022 · 7 comments
Assignees
Labels
Investigation Determine next steps

Comments

@xavierchow
Copy link

As one of the approaches to concurrency-safe mutating document, I need to get the CAS from the document and replace the doc with it.

I didn't find a documentation about the CAS retrieving, digging into the code it seems the findById only gets back the value(that is replaced by content according to latest sdk)

const key = _keyGenerator!(keyGenerator, { metadata, id }, keyGeneratorDelimiter);
const { value: pojo } = await collection().get(key, findOptions);

Will it be a good idea to have the ottoman to support both query CAS and update with it?
my two cents,

  • Enhancement on FindByIdOptions to allow querying the CAS
  • Enhancement on updateById to allow passing a CAS(probably via MutationFunctionOptions)?
@AV25242
Copy link
Contributor

AV25242 commented Apr 25, 2022

@gsi-alejandro can you please address this, I think we dont have this as a feature today like @xavierchow had mentioned. Is there a limitation as to not exposing the getOptions ?

@gsi-alejandro
Copy link
Collaborator

@AV25242

I think we can expose it, no problem.

@gsi-alejandro
Copy link
Collaborator

gsi-alejandro commented May 3, 2022

Next release we plan to expose a way to return the CAS value when available.

@xavierchow
Copy link
Author

@gsi-alejandro hey, any updates about this?

@superbogy
Copy link

superbogy commented Sep 22, 2022

+1

@AV25242
Copy link
Contributor

AV25242 commented Oct 10, 2022

@gsi-alejandro where are we on this ? cc @ejscribner @thejcfactor

@AV25242 AV25242 added the Investigation Determine next steps label Oct 10, 2022
@bsdelf
Copy link

bsdelf commented Mar 15, 2023

another solution is:

  • let IDocument hold the CAS as its internal data
  • add a boolean parameter to IDocument.save() method to enable CAS check when updating

therefore SDK user won't explicitly use the CAS at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigation Determine next steps
Projects
None yet
Development

No branches or pull requests

5 participants