Skip to content

Commit 7cc0d60

Browse files
committed
Factor metadata writing out into util function
Signed-off-by: DerGut <jannik.steinmann@gmx.de>
1 parent 333c65f commit 7cc0d60

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

crates/catalog/memory/src/catalog.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ impl MemoryCatalog {
7070
.file_io(self.file_io.clone())
7171
.build()
7272
}
73+
74+
async fn write_metadata(
75+
&self,
76+
metadata: &TableMetadata,
77+
metadata_location: &str,
78+
) -> Result<()> {
79+
self.file_io
80+
.new_output(metadata_location)?
81+
.write(serde_json::to_vec(metadata)?.into())
82+
.await
83+
}
7384
}
7485

7586
#[async_trait]
@@ -221,10 +232,7 @@ impl Catalog for MemoryCatalog {
221232
Uuid::new_v4()
222233
);
223234

224-
self.file_io
225-
.new_output(&metadata_location)?
226-
.write(serde_json::to_vec(&metadata)?.into())
227-
.await?;
235+
self.write_metadata(&metadata, &metadata_location).await?;
228236

229237
root_namespace_state.insert_new_table(&table_ident, metadata_location.clone())?;
230238

0 commit comments

Comments
 (0)