返回 Skill 列表
extension
分类: 开发与工程无需 API Key

libindex

libindex - 用于存储支持的数据的基础索引类。索引类提供了JSONL存储操作和过滤逻辑。BufferedIndex通过定期刷新增加了对大量写入的支持。可用于构建自定义索引、实现数据存储以及管理持久化集合。

person作者: jakexiaohubgithub

libindex Skill

When to Use

  • Building custom storage-backed indexes
  • Implementing JSONL-based data stores
  • Creating searchable collections with filtering
  • Managing high-volume write workloads

Key Concepts

Index: Base class providing read/write/filter operations on JSONL files. Subclass to create domain-specific indexes.

BufferedIndex: Extends Index with write buffering for high-throughput scenarios, flushing periodically.

Usage Patterns

Pattern 1: Create custom index

import { Index } from "@copilot-ld/libindex";

class UserIndex extends Index {
  constructor(storage) {
    super(storage, "users");
  }

  async findByEmail(email) {
    return this.filter((user) => user.email === email);
  }
}

Pattern 2: High-volume writes

import { BufferedIndex } from "@copilot-ld/libindex";

const index = new BufferedIndex(storage, "logs", { flushInterval: 5000 });
await index.append(logEntry); // Buffered
await index.flush(); // Force flush

Integration

Base class for VectorIndex, TraceIndex, ResourceIndex and other domain indexes.