pub fn write(
        &self,
        id: &NetworkIdentifier,
        network_configs: &[NetworkConfig],
    ) -> Result<(), Error> {
        // write each config to a StashNode under the network identifier. The key of the StashNode
        // will be STASH_PREFIX#<net_id>#<index>
        let id_key = Self::serialize_key(id)
            .map_err(|_| format_err!("failed to serialize network identifier"))?;

        // use a different number to separate each child network config
        let mut config_index = 0;
        let mut id_node = self.root.child(&id_key);
        for network_config in network_configs {
            let mut config_node = id_node.child(&config_index.to_string());
            write_config(&mut config_node, network_config)?;
            config_index += 1;
        }
        id_node.commit()
    }
/// Add or update network configs of a given network identifier to persistent storage.
Add or update network configs of a given network identifier to persistent storage.
Add or update network configs of a given network identifier to persistent storage .
pub fn write(
        &self,
        id: &NetworkIdentifier,
        network_configs: &[NetworkConfig],
    ) -> Result<(), Error> {
        // write each config to a StashNode under the network identifier. The key of the StashNode
        // will be STASH_PREFIX#<net_id>#<index>
        let id_key = Self::serialize_key(id)
            .map_err(|_| format_err!("failed to serialize network identifier"))?;
        // use a different number to separate each child network config
        let mut config_index = 0;
        let mut id_node = self.root.child(&id_key);
        for network_config in network_configs {
            let mut config_node = id_node.child(&config_index.to_string());
            write_config(&mut config_node, network_config)?;
            config_index += 1;
        }
        id_node.commit()
    }
pub fn write ( & self , id : & NetworkIdentifier , network_configs : & [ NetworkConfig ] , ) -> Result < ( ) , Error > { // write each config to a StashNode under the network identifier. The key of the StashNode // will be STASH_PREFIX#<net_id>#<index> let id_key = Self :: serialize_key ( id ) . map_err ( | _ | format_err ! ( " " ) ) ? ; // use a different number to separate each child network config let mut config_index = 0 ; let mut id_node = self . root . child ( & id_key ) ; for network_config in network_configs { let mut config_node = id_node . child ( & config_index . to_string ( ) ) ; write_config ( & mut config_node , network_config ) ? ; config_index += 1 ; } id_node . commit ( ) }
Add or update network configs of a given network identifier to persistent storage.
Add or update network configs of a given network identifier to persistent storage .
&self
id
&NetworkIdentifier
network_configs
&[NetworkConfig]
&self
id
&NetworkIdentifier
network_configs
&[NetworkConfig]