Skip to content

Commit 1708c5f

Browse files
committed
create glue catalog list
1 parent b288630 commit 1708c5f

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

  • catalogs/iceberg-glue-catalog/src

catalogs/iceberg-glue-catalog/src/lib.rs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use iceberg_rust::{
2020
identifier::Identifier,
2121
namespace::Namespace,
2222
tabular::Tabular,
23-
Catalog,
23+
Catalog, CatalogList,
2424
},
2525
error::Error as IcebergError,
2626
materialized_view::MaterializedView,
@@ -948,6 +948,40 @@ impl Catalog for GlueCatalog {
948948
}
949949
}
950950

951+
#[derive(Debug, Clone)]
952+
pub struct GlueCatalogList {
953+
name: String,
954+
config: SdkConfig,
955+
object_store_builder: ObjectStoreBuilder,
956+
}
957+
958+
impl GlueCatalogList {
959+
pub fn new(name: &str, config: &SdkConfig, object_store_builder: ObjectStoreBuilder) -> Self {
960+
Self {
961+
name: name.to_owned(),
962+
config: config.to_owned(),
963+
object_store_builder,
964+
}
965+
}
966+
}
967+
968+
#[async_trait]
969+
impl CatalogList for GlueCatalogList {
970+
fn catalog(&self, name: &str) -> Option<Arc<dyn Catalog>> {
971+
if self.name == name {
972+
Some(Arc::new(
973+
GlueCatalog::new(&self.config, &self.name, self.object_store_builder.clone())
974+
.unwrap(),
975+
))
976+
} else {
977+
None
978+
}
979+
}
980+
async fn list_catalogs(&self) -> Vec<String> {
981+
vec![self.name.clone()]
982+
}
983+
}
984+
951985
#[cfg(test)]
952986
pub mod tests {
953987
use aws_config::{BehaviorVersion, Region};

0 commit comments

Comments
 (0)