Skip to main content

Crate perfgate_server

Crate perfgate_server 

Source
Expand description

perfgate-server - REST API server for centralized baseline management.

This crate provides a REST API server for storing and managing performance baselines. It supports multiple storage backends (in-memory, SQLite, PostgreSQL) and includes authentication via API keys.

§Features

  • Multi-tenancy: Projects/namespaces for isolation
  • Version history: Track baseline versions over time
  • Rich metadata: Git refs, tags, custom metadata
  • Access control: Role-based permissions (Viewer, Contributor, Promoter, Admin)
  • Multiple backends: In-memory, SQLite, PostgreSQL (planned)

§Quick Start

use perfgate_server::{ServerConfig, StorageBackend, run_server};

#[tokio::main]
async fn main() {
    let config = ServerConfig::new()
        .bind("0.0.0.0:8080").unwrap()
        .storage_backend(StorageBackend::Sqlite)
        .sqlite_path("perfgate.db");

    run_server(config).await.unwrap();
}

§API Endpoints

MethodPathDescription
POST/projects/{project}/baselinesUpload a baseline
GET/projects/{project}/baselines/{benchmark}/latestGet latest baseline
GET/projects/{project}/baselines/{benchmark}/versions/{version}Get specific version
GET/projects/{project}/baselinesList baselines
DELETE/projects/{project}/baselines/{benchmark}/versions/{version}Delete baseline
POST/projects/{project}/baselines/{benchmark}/promotePromote version
GET/healthHealth check

Re-exports§

pub use auth::ApiKey;
pub use auth::ApiKeyStore;
pub use auth::AuthContext;
pub use auth::AuthState;
pub use auth::JwtClaims;
pub use auth::JwtConfig;
pub use auth::Role;
pub use auth::Scope;
pub use error::AuthError;
pub use error::ConfigError;
pub use error::StoreError;
pub use server::ServerConfig;
pub use server::StorageBackend;
pub use server::run_server;
pub use storage::BaselineStore;
pub use storage::InMemoryStore;
pub use storage::SqliteStore;
pub use storage::StorageHealth;
pub use models::*;

Modules§

auth
Authentication and authorization middleware.
error
Error types for the perfgate server.
handlers
API handlers for the baseline service.
models
Data models for the perfgate baseline service.
server
Server configuration and bootstrap.
storage
Storage trait and implementations for baseline persistence.

Constants§

VERSION
Server version string.