Skip to content
Snippets Groups Projects
Select Git revision
  • 754f4c4f7f23709ffea600a715baf6da11a2ab1c
  • master default protected
  • network/gtest-1000 protected
  • upgradable-multisig
  • runtime/gtest-1000
  • network/gdev-800 protected
  • cgeek/issue-297-cpu
  • gdev-800-tests
  • update-docker-compose-rpc-squid-names
  • fix-252
  • 1000i100-test
  • hugo/tmp-0.9.1
  • network/gdev-803 protected
  • hugo/endpoint-gossip
  • network/gdev-802 protected
  • hugo/distance-precompute
  • network/gdev-900 protected
  • tuxmain/anonymous-tx
  • debug/podman
  • hugo/195-doc
  • hugo/195-graphql-schema
  • gtest-1000-0.11.0 protected
  • gtest-1000 protected
  • gdev-900-0.10.1 protected
  • gdev-900-0.10.0 protected
  • gdev-900-0.9.2 protected
  • gdev-800-0.8.0 protected
  • gdev-900-0.9.1 protected
  • gdev-900-0.9.0 protected
  • gdev-803 protected
  • gdev-802 protected
  • runtime-801 protected
  • gdev-800 protected
  • runtime-800-bis protected
  • runtime-800 protected
  • runtime-800-backup protected
  • runtime-701 protected
  • runtime-700 protected
  • runtime-600 protected
  • runtime-500 protected
  • v0.4.1 protected
41 results

build-deb.md

Blame
    • Benjamin Gallois's avatar
      eb590e1c
      Fix #200 (!267) · eb590e1c
      Benjamin Gallois authored and Hugo Trentesaux's avatar Hugo Trentesaux committed
      * remove /ws from listen address
      
      * fix error when user already exist
      
      * change binary to duniter2
      
      * add rpc-cors
      
      * add config documentation
      
      * add reference in service files
      
      * use embedded distance oracle
      
      * optimize ci
      
      * use docker cache
      
      * add systemd timer
      
      * add documentation
      
      * fix base_path default
      
      * add duniter user
      
      * add services
      
      * update docs
      
      * add deb package to ci
      
      * add deb docker building
      eb590e1c
      History
      Fix #200 (!267)
      Benjamin Gallois authored and Hugo Trentesaux's avatar Hugo Trentesaux committed
      * remove /ws from listen address
      
      * fix error when user already exist
      
      * change binary to duniter2
      
      * add rpc-cors
      
      * add config documentation
      
      * add reference in service files
      
      * use embedded distance oracle
      
      * optimize ci
      
      * use docker cache
      
      * add systemd timer
      
      * add documentation
      
      * fix base_path default
      
      * add duniter user
      
      * add services
      
      * update docs
      
      * add deb package to ci
      
      * add deb docker building
    blocks_chunks.rs 4.86 KiB
    //  Copyright (C) 2020 Éloïs SANCHEZ.
    //
    // 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/>.
    
    use crate::*;
    use flate2::read::ZlibDecoder;
    use flate2::write::ZlibEncoder;
    use flate2::Compression;
    
    const CHUNK_SIZE: u32 = 4_096;
    const CHUNK_FILE_PREFIX: &str = "_";
    const CHUNK_FILE_EXT: &str = ".bin.gz";
    
    pub fn apply_block_blocks_chunk<B: Backend>(
        block: &DubpBlockV10,
        gva_db: &GvaV1Db<B>,
        profile_path: &Path,
    ) -> KvResult<()> {
        let block_number = block.number().0;
        let chunks_folder_path = profile_path.join("data/gva_v1_blocks_chunks");
    
        gva_db.current_blocks_chunk_write().upsert(
            U32BE(block_number),
            GvaBlockDbV1(DubpBlock::V10(block.clone())),
        )?;
    
        if (block_number + 1) % CHUNK_SIZE == 0 {
            let current_chunk: Vec<GvaBlockDbV1> = gva_db
                .current_blocks_chunk()
                .iter(.., |it| it.values().collect::<Result<Vec<_>, _>>())?;
            let current_chunk_bin = bincode_db()
                .serialize(&current_chunk)
                .map_err(|e| KvError::DeserError(e.into()))?;
            let chunk_hash = Hash::compute_blake3(current_chunk_bin.as_ref());
            let chunk_index = U32BE(block_number / CHUNK_SIZE);
            gva_db
                .blocks_chunk_hash_write()
                .upsert(chunk_index, HashDb(chunk_hash))?;
    
            write_and_compress_chunk_in_file(
                current_chunk_bin.as_ref(),
                chunk_index.0,
                chunks_folder_path.as_path(),
            )
            .map_err(|e| KvError::Custom(e.into()))?;
            gva_db.current_blocks_chunk_write().clear()?;
        }
    
        Ok(())
    }
    
    pub fn revert_block_blocks_chunk<B: Backend>(
        block: &DubpBlockV10,
        gva_db: &GvaV1Db<B>,
        profile_path: &Path,
    ) -> KvResult<()> {
        let block_number = block.number().0;
        let chunks_folder_path = profile_path.join("data/gva_v1_blocks_chunks");
        gva_db.write(|mut db| {