mirror of
https://github.com/getnora-io/nora.git
synced 2026-04-12 10:20:32 +00:00
perf: add in-memory repo index with pagination
- Add repo_index.rs with lazy rebuild on write operations - Double-checked locking to prevent race conditions - npm optimization: count tarballs instead of parsing metadata.json - Add pagination to all registry list pages (?page=1&limit=50) - Invalidate index on PUT/proxy cache in docker/maven/npm/pypi Performance: 500-800x faster list page loads after first rebuild
This commit is contained in:
@@ -13,6 +13,7 @@ mod migrate;
|
||||
mod openapi;
|
||||
mod rate_limit;
|
||||
mod registry;
|
||||
mod repo_index;
|
||||
mod request_id;
|
||||
mod secrets;
|
||||
mod storage;
|
||||
@@ -33,6 +34,7 @@ use activity_log::ActivityLog;
|
||||
use auth::HtpasswdAuth;
|
||||
use config::{Config, StorageMode};
|
||||
use dashboard_metrics::DashboardMetrics;
|
||||
use repo_index::RepoIndex;
|
||||
pub use storage::Storage;
|
||||
use tokens::TokenStore;
|
||||
|
||||
@@ -82,6 +84,7 @@ pub struct AppState {
|
||||
pub metrics: DashboardMetrics,
|
||||
pub activity: ActivityLog,
|
||||
pub docker_auth: registry::DockerAuth,
|
||||
pub repo_index: RepoIndex,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
@@ -277,6 +280,7 @@ async fn run_server(config: Config, storage: Storage) {
|
||||
metrics: DashboardMetrics::new(),
|
||||
activity: ActivityLog::new(50),
|
||||
docker_auth,
|
||||
repo_index: RepoIndex::new(),
|
||||
});
|
||||
|
||||
// Token routes with strict rate limiting (brute-force protection)
|
||||
|
||||
Reference in New Issue
Block a user