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

Assign instance IDs in the Supervisor [ECR-3746] #1552

Merged
merged 4 commits into from Nov 19, 2019

Conversation

popzxc
Copy link
Contributor

@popzxc popzxc commented Nov 18, 2019

This PR moves instance ID assignment logic from Dispatcher to the Supervisor.

I decided to not remove MAX_BUILTIN_INSTANCE_ID constant in this PR, but created a task in Jira for it (ECR-3851).

@popzxc popzxc added the supervisor Changes affecting the Supervisor service label Nov 18, 2019
@codecov
Copy link

codecov bot commented Nov 18, 2019

Codecov Report

Merging #1552 into dynamic_services will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@                 Coverage Diff                  @@
##           dynamic_services    #1552      +/-   ##
====================================================
+ Coverage             93.81%   93.82%   +<.01%     
====================================================
  Files                   203      203              
  Lines                 29498    29494       -4     
====================================================
- Hits                  27673    27672       -1     
+ Misses                 1825     1822       -3
Impacted Files Coverage Δ
exonum/src/runtime/dispatcher/mod.rs 91.2% <ø> (-0.29%) ⬇️
exonum/src/runtime/dispatcher/schema.rs 94.11% <ø> (-0.48%) ⬇️
exonum/src/runtime/rust/call_context.rs 92.45% <ø> (+1.07%) ⬆️
services/supervisor/src/proto_structures.rs 92.64% <100%> (+0.84%) ⬆️
exonum/src/blockchain/tests.rs 97.72% <100%> (+0.61%) ⬆️
services/supervisor/src/schema.rs 97.05% <100%> (+0.28%) ⬆️
services/supervisor/src/lib.rs 86.2% <100%> (ø) ⬆️

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 f33e636...78bc5c8. Read the comment docs.

let id = self
.vacant_instance_id
.get()
.unwrap_or(MAX_BUILTIN_INSTANCE_ID);
Copy link
Contributor

@aleksuss aleksuss Nov 18, 2019

Choose a reason for hiding this comment

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

What about to rename to FIRST_DEPLOYED_INSTANCE_ID ? As I can see builtin instance can't get id 1024.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It'll get removed soon anyway, so I don't think it matters (see ECR-3851) :)

@aleksuss aleksuss added this to the Release 0.13 milestone Nov 18, 2019
Co-Authored-By: Oleksandr Anyshchenko <oleksandr.anyshchenko@xdev.re>
access: &Prefixed<'a, T>,
index_name: &str,
) -> U {
FromAccess::from_access(access.clone(), index_name.into()).unwrap()
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this unwrap is really safe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Error is returned if the index exists but has a different type. Since this function is private and used only in the schema constructor (thus types are correct by design), this unwrap is indeed safe.

@aleksuss aleksuss merged commit 191d7ea into exonum:dynamic_services Nov 19, 2019
@popzxc popzxc deleted the assign-id-in-supervisor branch November 19, 2019 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
supervisor Changes affecting the Supervisor service
Development

Successfully merging this pull request may close these issues.

None yet

4 participants