Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make net_id the only unique identifier in a project's network collection, ensure consistent handling when specifying networks by their name or net_id, and fix a race condition when automatically assigning an index on network insertion.
Inserting multiple networks with the same name is not considered an error anymore. Only the assigned net_id, which is saved in the network document on the
_id
field, is considered unique.Various functions operating on a single network exist which identify the network by it's name. As this can be ambiguous, alternative functions which identify the network by net_id exist. Using the latter is recommended. The former still work but will throw an exception if multiple networks for the given name exist in the database.
The function which stores networks,
write_net_to_db
, can optionally be passed a custom value fornet_id
. This does not have to be an integer, but an incrementing integer is assigned asnet_id
if no value is passed.All functions affected by this change print out deprecation warnings with recommendations for replacements.
Possible breaking changes
A special handling of net_id in CRUD functions has been removed. Previously, these functions internally interpreted a passed net_id as the name of a network if it was of type string. This prohibits directly using strings as net_ids.
Function arguments specifying the net_id have sometimes been named
net
, these are now consistently namednet_id
to avoid confusion.