|
| 1 | +use crate::pg_catalog::empty_table::EmptyTable; |
| 2 | +use datafusion::arrow::datatypes::{DataType, Field, Schema}; |
| 3 | +use datafusion::catalog::TableProvider; |
| 4 | +use datafusion::error::Result; |
| 5 | +use std::sync::Arc; |
| 6 | + |
| 7 | +pub(crate) fn pg_replication_slots() -> Result<Arc<dyn TableProvider>> { |
| 8 | + let schema = Arc::new(Schema::new(vec![ |
| 9 | + Field::new("slot_name", DataType::Utf8, true), |
| 10 | + Field::new("plugin", DataType::Utf8, true), |
| 11 | + Field::new("slot_type", DataType::Utf8, true), |
| 12 | + Field::new("datoid", DataType::Int32, true), |
| 13 | + Field::new("database", DataType::Utf8, true), |
| 14 | + Field::new("temporary", DataType::Boolean, false), |
| 15 | + Field::new("active", DataType::Boolean, false), |
| 16 | + Field::new("active_pid", DataType::Int32, true), |
| 17 | + Field::new("xmin", DataType::Int32, true), |
| 18 | + Field::new("catalog_xmin", DataType::Int32, true), |
| 19 | + Field::new("restart_lsn", DataType::Utf8, true), // TODO: is this the correct type to use? |
| 20 | + Field::new("confirmed_flush_lsn", DataType::Utf8, true), // TODO: is this the correct type to use? |
| 21 | + Field::new("wal_status", DataType::Utf8, true), |
| 22 | + Field::new("safe_wal_size", DataType::Int64, true), |
| 23 | + Field::new("two_phase", DataType::Boolean, false), |
| 24 | + Field::new("conflicting", DataType::Boolean, false), |
| 25 | + ])); |
| 26 | + |
| 27 | + let table = EmptyTable::new(schema).try_into_memtable()?; |
| 28 | + |
| 29 | + Ok(Arc::new(table)) |
| 30 | +} |
0 commit comments