pub async fn new_empty(
        object_store: Arc<ObjectStore>,
        server_id: ServerId,
        db_name: impl Into<String>,
        state_data: S::EmptyInput,
    ) -> Result<Self> {
        let db_name = db_name.into();

        if Self::exists(&object_store, server_id, &db_name).await? {
            return Err(Error::AlreadyExists {});
        }

        let inner = PreservedCatalogInner {
            previous_tkey: None,
            state: Arc::new(S::new_empty(state_data)),
        };

        let catalog = Self {
            inner: RwLock::new(inner),
            transaction_semaphore: Semaphore::new(1),
            object_store,
            server_id,
            db_name,
        };

        // add empty transaction
        let transaction = catalog.open_transaction().await;
        transaction.commit().await?;

        Ok(catalog)
    }
/// Create new catalog w/o any data.
///
/// An empty transaction will be used to mark the catalog start so that concurrent open but still-empty catalogs can
/// easily be detected.
Create new catalog w/o any data.
An empty transaction will be used to mark the catalog start so that concurrent open but still-empty catalogs can
easily be detected.
Create new catalog w / o any data . An empty transaction will be used to mark the catalog start so that concurrent open but still - empty catalogs can easily be detected .
pub async fn new_empty(
        object_store: Arc<ObjectStore>,
        server_id: ServerId,
        db_name: impl Into<String>,
        state_data: S::EmptyInput,
    ) -> Result<Self> {
        let db_name = db_name.into();
        if Self::exists(&object_store, server_id, &db_name).await? {
            return Err(Error::AlreadyExists {});
        }
        let inner = PreservedCatalogInner {
            previous_tkey: None,
            state: Arc::new(S::new_empty(state_data)),
        };
        let catalog = Self {
            inner: RwLock::new(inner),
            transaction_semaphore: Semaphore::new(1),
            object_store,
            server_id,
            db_name,
        };
        // add empty transaction
        let transaction = catalog.open_transaction().await;
        transaction.commit().await?;
        Ok(catalog)
    }
pub async fn new_empty ( object_store : Arc < ObjectStore > , server_id : ServerId , db_name : impl Into < String > , state_data : S :: EmptyInput , ) -> Result < Self > { let db_name = db_name . into ( ) ; if Self :: exists ( & object_store , server_id , & db_name ) . await ? { return Err ( Error :: AlreadyExists { } ) ; } let inner = PreservedCatalogInner { previous_tkey : None , state : Arc :: new ( S :: new_empty ( state_data ) ) , } ; let catalog = Self { inner : RwLock :: new ( inner ) , transaction_semaphore : Semaphore :: new ( 1 ) , object_store , server_id , db_name , } ; // add empty transaction let transaction = catalog . open_transaction ( ) . await ; transaction . commit ( ) . await ? ; Ok ( catalog ) }
Create new catalog w/o any data.
Create new catalog w / o any data .
object_store
Arc<ObjectStore>
server_id
ServerId
db_name
impl Into<String>
state_data
S::EmptyInput
object_store
Arc<ObjectStore>
server_id
ServerId
db_name
impl Into<String>
state_data
S::EmptyInput