-
Notifications
You must be signed in to change notification settings - Fork 716
feat: better Serializer
for MutableConfigValue
#8421
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
Conversation
prev discussion about why we need a custom serializer implementation: #8400 |
Please update the title according to https://github.com/near/nearcore/blob/master/CONTRIBUTING.md#pull-requests For example: "feat: Better |
use std::fmt::Debug; | ||
use std::sync::{Arc, Mutex}; | ||
|
||
/// A wrapper for a config value that can be updated while the node is running. | ||
/// When initializing sub-objects (e.g. `ShardsManager`), please make sure to | ||
/// pass this wrapper instead of passing a value from a single moment in time. | ||
/// See `expected_shutdown` for an example how to use it. | ||
/// TODO: custom implementation for Serialize and Deserialize s.t. only value is necessary(JIRA:ND-283) | ||
#[derive(Clone, Debug, Serialize, Deserialize)] | ||
#[derive(Clone, Debug, Deserialize)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The derived implementation of Deserialize
is not compatible with the custom Serialize
implementation. Please consider removing the derived Deserialize
implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the derived deserializer for RpcClientConfigResponse, ClientConfig and MutableConfigValue. The /client_config is still working perfectly fine locally. Tested and confirmed serializer is needed here.
Also removed derived Debug for RpcClientConfigRequest and RpcClientConfigResponse as Debug does not seem necessary.
MutableConfigValue
MutableConfigValue
Serializer
for MutableConfigValue
* better Serializer for MutableConfigValue: only display value to users * remove derived Deserialize and DEBUG for RpcClientConfigResponse, ClientConfig, MutableConfigValue * remove RpcClientConfigRequest
When we enable dynamically config, we use a MutableConfigValue type to represent the mutable fields.
Only value field is valuable to end users. This PR aims to only show MutableConfigValue.value to users and hide the other 2 fields.
For example, if you navigate to /debug/client_config, and look at the field
expected_shutdown
, this PR should show"expected_shutdown": "null"
instead of
"expected_shutdown: "expected_shutdown":{"value":null,"field_name":"expected_shutdown","last_update":"2023-01-23T19:26:43.817152Z"}