diff --git a/pageserver/src/http/routes.rs b/pageserver/src/http/routes.rs
index 81ecdb7404..1d0adec63d 100644
--- a/pageserver/src/http/routes.rs
+++ b/pageserver/src/http/routes.rs
@@ -11,14 +11,13 @@ use super::models::{
StatusResponse, TenantConfigRequest, TenantCreateRequest, TenantCreateResponse, TenantInfo,
TimelineCreateRequest,
};
-use crate::layered_repository::metadata::TimelineMetadata;
+use crate::layered_repository::{metadata::TimelineMetadata, LayeredTimeline};
use crate::pgdatadir_mapping::DatadirTimeline;
use crate::repository::{LocalTimelineState, RepositoryTimeline};
use crate::repository::{Repository, Timeline};
use crate::storage_sync;
use crate::storage_sync::index::{RemoteIndex, RemoteTimeline};
use crate::tenant_config::TenantConfOpt;
-use crate::TimelineImpl;
use crate::{config::PageServerConf, tenant_mgr, timelines};
use utils::{
auth::JwtAuth,
@@ -86,7 +85,7 @@ fn get_config(request: &Request
) -> &'static PageServerConf {
// Helper functions to construct a LocalTimelineInfo struct for a timeline
fn local_timeline_info_from_loaded_timeline(
- timeline: &TimelineImpl,
+ timeline: &LayeredTimeline,
include_non_incremental_logical_size: bool,
include_non_incremental_physical_size: bool,
) -> anyhow::Result {
@@ -161,7 +160,7 @@ fn local_timeline_info_from_unloaded_timeline(metadata: &TimelineMetadata) -> Lo
}
fn local_timeline_info_from_repo_timeline(
- repo_timeline: &RepositoryTimeline,
+ repo_timeline: &RepositoryTimeline,
include_non_incremental_logical_size: bool,
include_non_incremental_physical_size: bool,
) -> anyhow::Result {
diff --git a/pageserver/src/layered_repository.rs b/pageserver/src/layered_repository.rs
index 8e75cbd4a2..6bf2e71852 100644
--- a/pageserver/src/layered_repository.rs
+++ b/pageserver/src/layered_repository.rs
@@ -59,7 +59,9 @@ mod storage_layer;
mod timeline;
use storage_layer::Layer;
-use timeline::{LayeredTimeline, LayeredTimelineEntry};
+use timeline::LayeredTimelineEntry;
+
+pub use timeline::LayeredTimeline;
// re-export this function so that page_cache.rs can use it.
pub use crate::layered_repository::ephemeral_file::writeback as writeback_ephemeral_file;
diff --git a/pageserver/src/lib.rs b/pageserver/src/lib.rs
index 140260e0d0..47fd8a84cf 100644
--- a/pageserver/src/lib.rs
+++ b/pageserver/src/lib.rs
@@ -28,7 +28,6 @@ use tracing::info;
use crate::thread_mgr::ThreadKind;
use metrics::{register_int_gauge_vec, IntGaugeVec};
-use layered_repository::LayeredRepository;
use pgdatadir_mapping::DatadirTimeline;
/// Current storage format version
@@ -62,9 +61,6 @@ pub enum CheckpointConfig {
Forced,
}
-pub type RepositoryImpl = LayeredRepository;
-pub type TimelineImpl = ::Timeline;
-
pub fn shutdown_pageserver(exit_code: i32) {
// Shut down the libpq endpoint thread. This prevents new connections from
// being accepted.
diff --git a/pageserver/src/repository.rs b/pageserver/src/repository.rs
index a1a08b11d5..d09b01437c 100644
--- a/pageserver/src/repository.rs
+++ b/pageserver/src/repository.rs
@@ -412,7 +412,6 @@ pub mod repo_harness {
use std::sync::{Arc, RwLock, RwLockReadGuard, RwLockWriteGuard};
use std::{fs, path::PathBuf};
- use crate::RepositoryImpl;
use crate::{
config::PageServerConf,
layered_repository::LayeredRepository,
@@ -508,11 +507,11 @@ pub mod repo_harness {
})
}
- pub fn load(&self) -> RepositoryImpl {
+ pub fn load(&self) -> LayeredRepository {
self.try_load().expect("failed to load test repo")
}
- pub fn try_load(&self) -> Result {
+ pub fn try_load(&self) -> Result {
let walredo_mgr = Arc::new(TestRedoManager);
let repo = LayeredRepository::new(
diff --git a/pageserver/src/tenant_mgr.rs b/pageserver/src/tenant_mgr.rs
index 5a5cea9a4b..d90cd7371a 100644
--- a/pageserver/src/tenant_mgr.rs
+++ b/pageserver/src/tenant_mgr.rs
@@ -3,7 +3,7 @@
use crate::config::PageServerConf;
use crate::http::models::TenantInfo;
-use crate::layered_repository::{load_metadata, LayeredRepository};
+use crate::layered_repository::{load_metadata, LayeredRepository, LayeredTimeline};
use crate::repository::Repository;
use crate::storage_sync::index::{RemoteIndex, RemoteTimelineIndex};
use crate::storage_sync::{self, LocalTimelineInitStatus, SyncStartupData};
@@ -12,7 +12,6 @@ use crate::thread_mgr::ThreadKind;
use crate::timelines::CreateRepo;
use crate::walredo::PostgresRedoManager;
use crate::{thread_mgr, timelines, walreceiver};
-use crate::{RepositoryImpl, TimelineImpl};
use anyhow::Context;
use serde::{Deserialize, Serialize};
use std::collections::hash_map::Entry;
@@ -96,13 +95,13 @@ mod tenants_state {
struct Tenant {
state: TenantState,
/// Contains in-memory state, including the timeline that might not yet flushed on disk or loaded form disk.
- repo: Arc,
+ repo: Arc,
/// Timelines, located locally in the pageserver's datadir.
/// Timelines can entirely be removed entirely by the `detach` operation only.
///
/// Local timelines have more metadata that's loaded into memory,
/// that is located in the `repo.timelines` field, [`crate::layered_repository::LayeredTimelineEntry`].
- local_timelines: HashMap::Timeline>>,
+ local_timelines: HashMap>,
}
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
@@ -179,7 +178,7 @@ pub enum LocalTimelineUpdate {
},
Attach {
id: ZTenantTimelineId,
- datadir: Arc<::Timeline>,
+ datadir: Arc,
},
}
@@ -369,7 +368,7 @@ pub fn set_tenant_state(tenant_id: ZTenantId, new_state: TenantState) -> anyhow:
Ok(())
}
-pub fn get_repository_for_tenant(tenant_id: ZTenantId) -> anyhow::Result> {
+pub fn get_repository_for_tenant(tenant_id: ZTenantId) -> anyhow::Result> {
let m = tenants_state::read_tenants();
let tenant = m
.get(&tenant_id)
@@ -383,7 +382,7 @@ pub fn get_repository_for_tenant(tenant_id: ZTenantId) -> anyhow::Result anyhow::Result> {
+) -> anyhow::Result> {
let mut m = tenants_state::write_tenants();
let tenant = m
.get_mut(&tenant_id)
@@ -488,9 +487,9 @@ pub fn detach_tenant(conf: &'static PageServerConf, tenant_id: ZTenantId) -> any
}
fn load_local_timeline(
- repo: &RepositoryImpl,
+ repo: &LayeredRepository,
timeline_id: ZTimelineId,
-) -> anyhow::Result> {
+) -> anyhow::Result> {
let inmem_timeline = repo.get_timeline_load(timeline_id).with_context(|| {
format!("Inmem timeline {timeline_id} not found in tenant's repository")
})?;
@@ -634,7 +633,7 @@ fn load_local_repo(
conf: &'static PageServerConf,
tenant_id: ZTenantId,
remote_index: &RemoteIndex,
-) -> anyhow::Result> {
+) -> anyhow::Result> {
let mut m = tenants_state::write_tenants();
let tenant = m.entry(tenant_id).or_insert_with(|| {
// Set up a WAL redo manager, for applying WAL records.
diff --git a/pageserver/src/timelines.rs b/pageserver/src/timelines.rs
index 6002e8b2d9..c5b938c5fe 100644
--- a/pageserver/src/timelines.rs
+++ b/pageserver/src/timelines.rs
@@ -21,10 +21,13 @@ use utils::{
use crate::tenant_mgr;
use crate::{
config::PageServerConf, repository::Repository, storage_sync::index::RemoteIndex,
- tenant_config::TenantConfOpt, RepositoryImpl, TimelineImpl,
+ tenant_config::TenantConfOpt,
};
use crate::{import_datadir, LOG_FILE_NAME};
-use crate::{layered_repository::LayeredRepository, walredo::WalRedoManager};
+use crate::{
+ layered_repository::{LayeredRepository, LayeredTimeline},
+ walredo::WalRedoManager,
+};
use crate::{repository::Timeline, CheckpointConfig};
#[derive(Debug, Clone, Copy)]
@@ -73,7 +76,7 @@ pub fn create_repo(
tenant_conf: TenantConfOpt,
tenant_id: ZTenantId,
create_repo: CreateRepo,
-) -> Result> {
+) -> Result> {
let (wal_redo_manager, remote_index) = match create_repo {
CreateRepo::Real {
wal_redo_manager,
@@ -223,7 +226,7 @@ pub(crate) fn create_timeline(
new_timeline_id: Option,
ancestor_timeline_id: Option,
mut ancestor_start_lsn: Option,
-) -> Result