Skip to main content

Crate jdb_pgm

Crate jdb_pgm 

Source
Expand description

§Pgm-Index: Ultra-Fast Learned Index

Pgm 索引:超快的学习型索引

Piecewise Geometric Model (Pgm) Index for fast lookups in sorted arrays. 分段几何模型(Pgm)索引,用于在已排序数组中快速查找。

§Usage / 使用方法

use jdb_pgm::{Pgm, PgmData};

// Pgm: no data ownership, for SSTable etc.
// Pgm:不持有数据,适用于 SSTable 等场景
let data: Vec<u64> = (0..1000).collect();
let pgm = Pgm::new(&data, 32, true).unwrap();
let range = pgm.predict_range(500);
assert!(range.contains(&500));

// PgmData: with data ownership
// PgmData:持有数据
let pgm_data = PgmData::load(data, 32, true).unwrap();
assert_eq!(pgm_data.get(500), Some(500));

Re-exports§

pub use error::PgmError;
pub use error::Result;

Modules§

bench_common
Common benchmark traits 通用基准测试特征
error
Error definitions for Pgm-Index Pgm 索引错误定义

Structs§

Pgm
Pgm-Index core structure (no data ownership, serializable) Pgm 索引核心结构(不持有数据,可序列化)
PgmData
Pgm-Index with data ownership 持有数据的 Pgm 索引
PgmStats
Index statistics 索引统计信息
Segment
Linear segment: y = slope * x + intercept 线性段:y = slope * x + intercept

Constants§

LUT_BINS_MULTIPLIER
MAX_LUT_BINS
MIN_EPSILON
MIN_LUT_BINS

Traits§

Key
Key trait for supported types 支持的键类型约束
ToKey
Trait for types that can be converted to Key and provide bytes reference 可转换为 Key 并提供字节引用的类型 trait

Functions§

build_lut
Build lookup table for fast segment search 构建查找表以快速搜索段
build_segments
Build segments using the streaming shrinking cone algorithm. 使用流式收缩锥算法构建段 (O(N))
key_to_u64

Type Aliases§

PgmIndex
Alias for backward compatibility 向后兼容的别名