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

refactor: keck apis #233

Closed
wants to merge 4 commits into from
Closed

Conversation

fundon
Copy link
Contributor

@fundon fundon commented Mar 2, 2023

No description provided.

@fundon fundon marked this pull request as draft March 2, 2023 15:03
@fundon fundon temporarily deployed to development March 2, 2023 15:04 — with GitHub Actions Inactive
@darkskygit
Copy link
Member

darkskygit commented Mar 2, 2023

Maybe we can consider encapsulating some transaction apis into with_trx like this:

workspace.with_trx(|trx| {
  trx.get(&block_id);
});

And all the block instances obtained in trx are an instance that encapsulates the original block instance and transaction. At this point, we can continue to use this instance to operate the block:

workspace.with_trx(|trx| {
  let block = trx.get(&block_id);
  block.set("key", "value");
});

@fundon
Copy link
Contributor Author

fundon commented Mar 2, 2023

Agree, trx already contains workspace reference instance.
This step can be put at the end.

@fundon fundon temporarily deployed to development March 3, 2023 01:33 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to development March 3, 2023 01:33 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to development March 3, 2023 02:00 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to development March 3, 2023 02:00 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to development March 3, 2023 07:30 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to development March 3, 2023 07:30 — with GitHub Actions Inactive
@darkskygit
Copy link
Member

darkskygit commented Mar 3, 2023

Maybe we can consider encapsulating some transaction apis into with_trx like this:

workspace.with_trx(|trx| {
  trx.get(&block_id);
});

And all the block instances obtained in trx are an instance that encapsulates the original block instance and transaction. At this point, we can continue to use this instance to operate the block:

workspace.with_trx(|trx| {
  let block = trx.get(&block_id);
  block.set("key", "value");
});

I added more improvement intents in #235
relevant context, please go to this issue to discuss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants