-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Add epoch activity REST endpoints with optional historical storage #89
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
feat: Add epoch activity REST endpoints with optional historical storage #89
Conversation
Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
API/openapi.yaml
Outdated
content: | ||
application/json: | ||
schema: | ||
type: object |
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.
To avoid duplication you can reference common structures with $ref - e.g.
content:
application/json:
schema:
$ref: '#/components/schemas/EpochData'
Then later (at top level)
components:
schemas:
EpochData:
type: object
properties:
...
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 made all 200 return types into components with shared subcomponents to clean up the top level paths in the latest commit.
@@ -53,21 +65,48 @@ impl State { | |||
"End of epoch" | |||
); | |||
|
|||
let epoch_activity = EpochActivityMessage { |
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.
This could just be self.get_current_epoch() now, right? Although you'd have to clear the vrf_key_hashes separately.
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.
Fixed.
use tokio::sync::Mutex; | ||
|
||
#[derive(Serialize)] | ||
pub struct EpochActivityRest { |
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.
Feels like this could be the more natural thing to store (without the Rest suffix), and derive the EpochActivityMessage from that? Would save (duplicated) conversions below.
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.
That was dumb - VRF keys are encoded strings in the REST version. Please ignore!
…tivityMessage Signed-off-by: William Hankins <[email protected]>
Signed-off-by: William Hankins <[email protected]>
This PR:
current_epoch
and optionalepoch_history
fields to theepoch_activity_counter
state.store-history
config option inomnibus.toml
to enable historical epoch activity storage./epoch
and/epochs/{epoch_number}
REST endpoints mentioned in Add REST endpoint to EpochActivityCounter #84.openapi.yaml
to document new endpoints