You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: persistent.rs
    path of file: ./repos/qdrant/lib/storage/src/content_manager/consensus
    
    the code of the file until where you have to start completion: use std::cmp;
use std::fs::{create_dir_all, File};
use std::io::BufWriter;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;

use atomicwrites::{AllowOverwrite, AtomicFile};
use collection::shards::shard::PeerId;
use http::Uri;
use parking_lot::RwLock;
use raft::eraftpb::{ConfState, HardState, SnapshotMetadata};
use raft::RaftState;
use serde::{Deserialize, Serialize};

use crate::content_manager::consensus::entry_queue::{EntryApplyProgressQueue, EntryId};
use crate::types::{PeerAddressById, PeerMetadata, PeerMetadataById};
use crate::StorageError;

// Deprec
    
    fn init(path: PathBuf, first_peer: bool) -> Result<Self, StorageError> {
        // Do not generate too big peer ID, to avoid problems with serialization
        // (especially in json format)
        let this_peer_id = rand::random::<PeerId>() % (1 << 53);
        let voters = if first_peer {
            vec![this_peer_id]
        } else {
            // `Some(false)` - Leave empty the network topology for the peer, if it is not starting a network itself.
            // This way it will not be able to become a leader and commit data
            // until it joins an existing network.
            vec![]
        };
        let state = Self {
            state: RaftState {
                hard_state: HardState::default(),
                // For network with 1 node, set it as voter.
                // First vec is voters, second is learners.
                conf_state: ConfState::from((voters, vec![])),
            },
            apply_progress_queue: Default::default(),
            peer_address_by_id: Default::default(),
            peer_metadata_by_id: Default::default(),
            this_peer_id,
            path,
            latest_snapshot_meta: Default::default(),
            dirty: AtomicBool::new(false),
        };
        state.save()?;
        Ok(state)
    }