fn apply(
        &mut self,
        authz: polixy::ServerAuthorization,
        servers: &mut SrvIndex,
        domain: &str,
    ) -> Result<()> {
        let name = authz.name();
        let authz = mk_authz(authz, domain)?;

        match self.index.entry(name) {
            HashEntry::Vacant(entry) => {
                servers.add_authz(entry.key(), &authz.servers, authz.clients.clone());
                entry.insert(authz);
            }

            HashEntry::Occupied(mut entry) => {
                // If the authorization changed materially, then update it in all servers.
                if entry.get() != &authz {
                    servers.add_authz(entry.key(), &authz.servers, authz.clients.clone());
                    entry.insert(authz);
                }
            }
        }

        Ok(())
    }
/// Updates the authorization and server indexes with a new or updated authorization instance.
Updates the authorization and server indexes with a new or updated authorization instance.
Updates the authorization and server indexes with a new or updated authorization instance .
fn apply(
        &mut self,
        authz: polixy::ServerAuthorization,
        servers: &mut SrvIndex,
        domain: &str,
    ) -> Result<()> {
        let name = authz.name();
        let authz = mk_authz(authz, domain)?;
        match self.index.entry(name) {
            HashEntry::Vacant(entry) => {
                servers.add_authz(entry.key(), &authz.servers, authz.clients.clone());
                entry.insert(authz);
            }
            HashEntry::Occupied(mut entry) => {
                // If the authorization changed materially, then update it in all servers.
                if entry.get() != &authz {
                    servers.add_authz(entry.key(), &authz.servers, authz.clients.clone());
                    entry.insert(authz);
                }
            }
        }
        Ok(())
    }
fn apply ( & mut self , authz : polixy :: ServerAuthorization , servers : & mut SrvIndex , domain : & str , ) -> Result < ( ) > { let name = authz . name ( ) ; let authz = mk_authz ( authz , domain ) ? ; match self . index . entry ( name ) { HashEntry :: Vacant ( entry ) => { servers . add_authz ( entry . key ( ) , & authz . servers , authz . clients . clone ( ) ) ; entry . insert ( authz ) ; } HashEntry :: Occupied ( mut entry ) => { // If the authorization changed materially, then update it in all servers. if entry . get ( ) != & authz { servers . add_authz ( entry . key ( ) , & authz . servers , authz . clients . clone ( ) ) ; entry . insert ( authz ) ; } } } Ok ( ( ) ) }
Updates the authorization and server indexes with a new or updated authorization instance.
Updates the authorization and server indexes with a new or updated authorization instance .
&mut self
authz
polixy::ServerAuthorization
servers
&mut SrvIndex
domain
&str
&mut self
authz
polixy::ServerAuthorization
servers
&mut SrvIndex
domain
&str