pub async fn open(configuration: ServerConfiguration) -> Result<Self, Error> {
        let request_processor = Manager::default();
        for _ in 0..configuration.request_workers {
            request_processor.spawn_worker();
        }

        let storage = Storage::open(configuration.storage.with_schema::<Hosted>()?).await?;

        storage.create_database::<Hosted>("_hosted", true).await?;

        let default_permissions = Permissions::from(configuration.default_permissions);
        let authenticated_permissions = Permissions::from(configuration.authenticated_permissions);

        let server = Self {
            data: Arc::new(Data {
                clients: RwLock::default(),
                storage,
                endpoint: RwLock::default(),
                request_processor,
                default_permissions,
                authenticated_permissions,
                client_simultaneous_request_limit: configuration.client_simultaneous_request_limit,
                primary_tls_key: CachedCertifiedKey::default(),
                primary_domain: configuration.server_name,
                #[cfg(feature = "acme")]
                acme: configuration.acme,
                #[cfg(feature = "acme")]
                alpn_keys: AlpnKeys::default(),
                shutdown: Shutdown::new(),
                relay: Relay::default(),
                subscribers: Arc::default(),
                _backend: PhantomData::default(),
            }),
        };
        B::initialize(&server).await;
        Ok(server)
    }
/// Opens a server using `directory` for storage.
Opens a server using `directory` for storage.
Opens a server using ` directory ` for storage .
pub async fn open(configuration: ServerConfiguration) -> Result<Self, Error> {
        let request_processor = Manager::default();
        for _ in 0..configuration.request_workers {
            request_processor.spawn_worker();
        }
        let storage = Storage::open(configuration.storage.with_schema::<Hosted>()?).await?;
        storage.create_database::<Hosted>("_hosted", true).await?;
        let default_permissions = Permissions::from(configuration.default_permissions);
        let authenticated_permissions = Permissions::from(configuration.authenticated_permissions);
        let server = Self {
            data: Arc::new(Data {
                clients: RwLock::default(),
                storage,
                endpoint: RwLock::default(),
                request_processor,
                default_permissions,
                authenticated_permissions,
                client_simultaneous_request_limit: configuration.client_simultaneous_request_limit,
                primary_tls_key: CachedCertifiedKey::default(),
                primary_domain: configuration.server_name,
                #[cfg(feature = "acme")]
                acme: configuration.acme,
                #[cfg(feature = "acme")]
                alpn_keys: AlpnKeys::default(),
                shutdown: Shutdown::new(),
                relay: Relay::default(),
                subscribers: Arc::default(),
                _backend: PhantomData::default(),
            }),
        };
        B::initialize(&server).await;
        Ok(server)
    }
pub async fn open ( configuration : ServerConfiguration ) -> Result < Self , Error > { let request_processor = Manager :: default ( ) ; for _ in 0 .. configuration . request_workers { request_processor . spawn_worker ( ) ; } let storage = Storage :: open ( configuration . storage . with_schema :: < Hosted > ( ) ? ) . await ? ; storage . create_database :: < Hosted > ( " " , true ) . await ? ; let default_permissions = Permissions :: from ( configuration . default_permissions ) ; let authenticated_permissions = Permissions :: from ( configuration . authenticated_permissions ) ; let server = Self { data : Arc :: new ( Data { clients : RwLock :: default ( ) , storage , endpoint : RwLock :: default ( ) , request_processor , default_permissions , authenticated_permissions , client_simultaneous_request_limit : configuration . client_simultaneous_request_limit , primary_tls_key : CachedCertifiedKey :: default ( ) , primary_domain : configuration . server_name , # [ cfg ( feature " " ) ] acme : configuration . acme , # [ cfg ( feature " " ) ] alpn_keys : AlpnKeys :: default ( ) , shutdown : Shutdown :: new ( ) , relay : Relay :: default ( ) , subscribers : Arc :: default ( ) , _backend : PhantomData :: default ( ) , } ) , } ; B :: initialize ( & server ) . await ; Ok ( server ) }
Opens a server using `directory` for storage.
Opens a server using ` directory ` for storage .
configuration
ServerConfiguration
configuration
ServerConfiguration