go-spacemesh icon indicating copy to clipboard operation
go-spacemesh copied to clipboard

3281 crud epoch status draft

Open abergasov opened this issue 2 years ago • 1 comments

Motivation

Closes #3281

Changes

related api changes pr https://github.com/spacemeshos/api/pull/170 added endpoint serving status current epoch.

type SmeshingStatusResponse struct {
  status: enum,
  epoch: uint64;
  estimatedTime: number; // optional. for statuses 'generating_pos_data' | 'generating_pos_proof' | 'waiting_for_poet'
  reason: string; // optional. possible error of file generating
}

to existing endpoints was added fields for show progress of post generating

message PostSetupStatus {
    ...
    string processed_hrp = 5; // The processed size, like `176 GB`
    string processing_total_size = 6; // Total size, that should be processed, like `256 GB`
    uint32 processed_percentage = 7; // The processed percentage, like `50`
}

endpoint select info and show result.

Showing data about smeshing progress

as we have indexes in table atxs for (epoch, smesher) - in endpoint request need smesherID which will be used for load data

Test Plan

TODO

  • [x] Explain motivation or link existing issue(s)
  • [ ] Test changes and document test plan
  • [ ] Update documentation as needed

DevOps Notes

  • [x] This PR does not require configuration changes (e.g., environment variables, GitHub secrets, VM resources)
  • [ ] This PR does not affect public APIs
  • [x] This PR does not rely on a new version of external services (PoET, elasticsearch, etc.)
  • [x] This PR does not make changes to log messages (which monitoring infrastructure may rely on)

abergasov avatar Jul 01 '22 07:07 abergasov

post is not built in every epoch. it is built once at the start, and on demand if smesher wants to resize it

atxs are built for each epoch. for all past epochs smeshing status can be based on the atx that is stored in the database (or not stored). for current epoch it can be based on the state of the atx builder. saving additional data will introduce inconsistencies between the actual state of the atx builder and what is stored in the database.

i would suggest the following implementation plan:

  • dont add new tables
  • for current epoch get the smeshing status based on the state of the atx builder
  • for past epochs drop smeshing status. for all UI purposes existing activations can be used
  • consider providing stream api for smeshing statuses

dshulyak avatar Jul 01 '22 07:07 dshulyak