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

Strip down namespace object and clean up APIs #898

Merged
merged 10 commits into from
Jul 20, 2022

Conversation

awrichar
Copy link
Contributor

@awrichar awrichar commented Jul 12, 2022

Part of FIR-12
In a chain with #895

Remove all remaining functionality related to broadcasting namespaces. It was already broken from previous commits, but this is now to confirm:

  • any previously-broadcast namespaces that are not spelled out in the config will cease to function in the next release
  • in the future, if we want to add back dynamic namespace capability, it will probably take the form of editing the config file and adding a local API that reloads the config dynamically

Clean up the /namespaces/{ns} and /namespaces/{ns}/status APIs to be a little more organized.

Clean up all namespace database operations to happen from Namespace Manager. Pass a pointer to the namespace object to any other managers that need it.

@codecov-commenter
Copy link

codecov-commenter commented Jul 12, 2022

Codecov Report

Merging #898 (4ea1619) into main (8e17c9a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #898   +/-   ##
=======================================
  Coverage   99.97%   99.98%           
=======================================
  Files         298      297    -1     
  Lines       19473    19400   -73     
=======================================
- Hits        19469    19397   -72     
+ Misses          4        3    -1     
Impacted Files Coverage Δ
internal/apiserver/route_get_websockets.go 100.00% <ø> (ø)
internal/database/sqlcommon/sqlcommon.go 100.00% <ø> (ø)
internal/definitions/handler.go 100.00% <ø> (ø)
internal/namespace/persistence_events.go 100.00% <ø> (ø)
internal/orchestrator/persistence_events.go 96.29% <ø> (+3.43%) ⬆️
internal/txcommon/event_enrich.go 100.00% <ø> (ø)
pkg/core/event.go 100.00% <ø> (ø)
internal/apiserver/route_get_namespace.go 100.00% <100.00%> (ø)
internal/apiserver/route_get_status.go 100.00% <100.00%> (ø)
...ernal/apiserver/route_spi_get_namespace_by_name.go 100.00% <100.00%> (ø)
... and 12 more

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Although it's stored on the namespace object, this is more appropriate as a
piece of the namespace status (next to the list of plugins, etc).

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Keep it separate from the user-configured values.

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Namespaces will no longer store an ID, type, or message ID in the database.
They will no longer emit SPI events.

The /status API will also return all namespace details as an object, instead
of just returning a name.

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
@awrichar awrichar force-pushed the status branch 5 times, most recently from 6471067 to f6a07a8 Compare July 12, 2022 18:26
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
@awrichar awrichar force-pushed the status branch 2 times, most recently from 9ce561c to 0d2a461 Compare July 13, 2022 20:17
// NodeStatusPlugin field descriptions
NodeStatusPluginName = ffm("NodeStatusPlugin.name", "The name of the plugin")
NodeStatusPluginType = ffm("NodeStatusPlugin.pluginType", "The type of the plugin")
NamespaceID = ffm("Namespace.id", "The UUID of the namespace. For locally established namespaces will be different on each node in the network. For broadcast namespaces, will be the same on every node")
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to change these descriptions to get rid of the broadcast terminology?

case stored != nil:
stored.RemoteName = ns.remoteName
stored.Description = ns.description
// TODO: should we check for discrepancies in the multiparty contract config?
Copy link
Member

@shorsher shorsher Jul 20, 2022

Choose a reason for hiding this comment

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

Should we do this and return an error? At a minimum, maybe we add a log statement that we're overwriting a stored config that has differences.

PluginType string `ffstruct:"NamespaceStatusPlugin" json:"pluginType"`
}

type NamespaceStatusMultiparty struct {
Copy link
Member

Choose a reason for hiding this comment

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

Does this struct need a comment since it's exported?

Copy link
Member

@shorsher shorsher left a comment

Choose a reason for hiding this comment

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

Love seeing all the deleted code, just a few questions for consideration.

@shorsher
Copy link
Member

Merging this, made a task on the board to revisit these comments before release.

@shorsher shorsher merged commit ce9d5a5 into hyperledger:main Jul 20, 2022
@shorsher shorsher deleted the status branch July 20, 2022 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants