Skip to content
Snippets Groups Projects
Commit e3f8f29d authored by Millicent Billette's avatar Millicent Billette
Browse files

wip bc-db-writer roadmap

parent 260e87cf
Branches
Tags
No related merge requests found
...@@ -50,7 +50,7 @@ pub fn insert_new_head_block( ...@@ -50,7 +50,7 @@ pub fn insert_new_head_block(
crate::current_meta_datas::update_current_meta_datas(db, w, &dal_block.block)?; crate::current_meta_datas::update_current_meta_datas(db, w, &dal_block.block)?;
// Update stores linked to MAIN_BLOCKS // Update stores linked to MAIN_BLOCKS
crate::store_name::update_store_name(db, w, &dal_block.block)?; crate::current_frame::update_current_frame(db, w, &dal_block.block)?;
if let Some(fork_tree) = fork_tree { if let Some(fork_tree) = fork_tree {
// Insert head block in fork tree // Insert head block in fork tree
......
...@@ -24,6 +24,43 @@ use durs_bc_db_reader::constants::*; ...@@ -24,6 +24,43 @@ use durs_bc_db_reader::constants::*;
use durs_bc_db_reader::current_meta_datas::get_current_blockstamp_; use durs_bc_db_reader::current_meta_datas::get_current_blockstamp_;
use durs_bc_db_reader::current_meta_datas::CurrentMetaDataKey; use durs_bc_db_reader::current_meta_datas::CurrentMetaDataKey;
use durs_bc_db_reader::{DbValue,DbReader}; use durs_bc_db_reader::{DbValue,DbReader};
use dubp_block_doc::BlockDocument;
// TODO: revert_current_frame
pub(crate) fn update_current_frame(
_db: &Db,
_w: &mut DbWriter,
_new_current_block: &BlockDocument,
) -> Result<(), DbError> {
unimplemented!();
//Ok(())
// 1. dans CURRENT_FRAME_MEMBERS
// pour le WotId du nouveau bloc
// last_block = CurrentBlockNumber
// block_count++ OR 1 si nouvelle clef
// pour les WotId des 0 à 2 blocs sortant (à récupérer via une queue)
// block_count-- Si 0 supprimer la clef
// 2. créer SortedFrameMemberTable : Vec<(bloc_count : u32, WotId)>
// en extraire la valeur médiane MedianFrameMember
// 3. dans CURRENT_META_DATAS
// CurrentFrameMembersSize += diff clef WotId ajoutée/supprimée
// MedianFrameMember = MedianFrameMember
// CurrentFrameFIFO
}
// fn update_current_frame_fifo
// fn push_in_current_frame_fifo
// update_current_frame_members <- add WotId
// fn pop_in_current_frame_fifo
// 0-2 update_current_frame_members <- rm WotId
// (fn update_current_frame_members)
// fn write_current_frame_fifo_in_store
// fn update_median_forged_blocks_in_current_frame
// fn get_current_frame durs-bc-db-reader (mais comment on l'initialise au lancement ?)
// chercher rust compute median (en ligne) si pas d'algo sans tri : fn sort_current_frame_members_by_forged_blocks (en itérant/transformant la structure précédente)
// fn compute_median_forged_blocks_in_current_frame (à partir du tableau trié)
// fn update_current_frame_meta_data (sauf fifo)
/// Compute the personal difficulty of a member. /// Compute the personal difficulty of a member.
......
...@@ -34,7 +34,6 @@ pub mod blocks; ...@@ -34,7 +34,6 @@ pub mod blocks;
pub mod current_frame; pub mod current_frame;
pub mod current_meta_datas; pub mod current_meta_datas;
pub mod indexes; pub mod indexes;
pub mod store_name;
pub mod writers; pub mod writers;
pub use durs_dbs_tools::kv_db::{ pub use durs_dbs_tools::kv_db::{
......
// Copyright (C) 2017-2019 The AXIOM TEAM Association.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! "store name" storage: define write requests.
use crate::{Db, DbWriter};
use dubp_block_doc::BlockDocument;
use durs_dbs_tools::DbError;
pub(crate) fn update_store_name(
_db: &Db,
_w: &mut DbWriter,
_new_current_block: &BlockDocument,
) -> Result<(), DbError> {
//unimplemented!()
Ok(())
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment