fn build()

in core/src/services/tikv/backend.rs [110:137]


    fn build(&mut self) -> Result<Self::Accessor> {
        let endpoints = self.endpoints.take().ok_or_else(|| {
            Error::new(
                ErrorKind::ConfigInvalid,
                "endpoints is required but not set",
            )
            .with_context("service", Scheme::Tikv)
        })?;

        if self.insecure
            && (self.ca_path.is_some() || self.key_path.is_some() || self.cert_path.is_some())
        {
            return Err(
                Error::new(ErrorKind::ConfigInvalid, "invalid tls configuration")
                    .with_context("service", Scheme::Tikv)
                    .with_context("endpoints", format!("{:?}", endpoints)),
            )?;
        }

        Ok(Backend::new(Adapter {
            client: OnceCell::new(),
            endpoints,
            insecure: self.insecure,
            ca_path: self.ca_path.clone(),
            cert_path: self.cert_path.clone(),
            key_path: self.key_path.clone(),
        }))
    }