"""RBSP Indexing Engine.

Provides the full indexing pipeline for the Resonance-Based Semantic Protocol:

- **FileSystemWatcher**:      Cross-platform file system monitoring
- **PreIndexer**:             Directory-tree indexing at creation time
- **InvertedIndex**:          Token-to-document mapping for keyword search
- **SemanticClusterEngine**:  LSH-based semantic grouping
- **MMapStore**:              Memory-mapped persistent key-value storage
- **IncrementalEngine**:      Change-detection for efficient re-indexing
- **SegmentManager**:         Lucene-style segment-based index architecture
- **MergePolicy**:            Segment merge policy (tiered / log)
- **PositionIndex**:          Term position index for phrase and proximity queries
- **PostingList**:            Compressed postings list with skip pointers
- **PostingEntry**:           Single posting entry (doc_id, term_freq, positions)
- **ReadWriteLock**:          Readers-writer lock with writer preference
- **ConcurrentIndex**:        Read-write locking wrapper for any index
- **IndexGeneration**:        Generation-based concurrency (Lucene-style)
- **DeletionBitmap**:         Tombstone bitmap for soft-deleted documents
- **DeletionTracker**:        Per-segment deletion bitmap management
- **DocValuesStore**:         Columnar per-document field values for sorting/faceting
- **IndexWarmer**:            Index preloading and cache warming for fast first queries
- **WriteAheadLog**:          Write-ahead log with CRC32 checksums and crash recovery

All components are thread-safe and designed for O(1) lookup performance.
"""

from rbsp.indexer.watcher import FileSystemWatcher, FileEvent
from rbsp.indexer.preindex import PreIndexer, IndexProgress
from rbsp.indexer.inverted import InvertedIndex, tokenize, tokenize_unique, parse_query
from rbsp.indexer.clusters import SemanticClusterEngine
from rbsp.indexer.mmap_store import MMapStore
from rbsp.indexer.incremental import IncrementalEngine
from rbsp.indexer.segments import Segment, SegmentInfo, SegmentManager
from rbsp.indexer.positions import PositionIndex
from rbsp.indexer.merge import (
    MergePolicy,
    TieredMergePolicy,
    LogMergePolicy,
    MergeSegment,
)
from rbsp.indexer.concurrent import ReadWriteLock, ConcurrentIndex, IndexGeneration
from rbsp.indexer.deletion import DeletionBitmap, DeletionTracker
from rbsp.indexer.warmup import IndexWarmer, WarmupConfig, WarmupStats
from rbsp.indexer.vector_store import (
    VectorStore,
    FilterExpression,
    FieldCondition,
    And,
    Or,
    Not,
)
from rbsp.indexer.wal import (
    WriteAheadLog,
    WALConfig,
    WALEntry,
    WALOperation,
    SyncMode,
)

from rbsp.indexer.docvalues import (
    DocValueType,
    NumericDocValues,
    BinaryDocValues,
    SortedDocValues,
    SortedSetDocValues,
    DocValuesStore,
)

__all__ = [
    # Watcher
    "FileSystemWatcher",
    "FileEvent",
    # Pre-indexer
    "PreIndexer",
    "IndexProgress",
    # Inverted index
    "InvertedIndex",
    "tokenize",
    "tokenize_unique",
    "parse_query",
    # Clusters
    "SemanticClusterEngine",
    # Storage
    "MMapStore",
    # Incremental
    "IncrementalEngine",
    # Segments
    "Segment",
    "SegmentInfo",
    "SegmentManager",
    # Merge policies
    "MergePolicy",
    "TieredMergePolicy",
    "LogMergePolicy",
    "MergeSegment",
    # Position index
    "PositionIndex",
    # Concurrent
    "ReadWriteLock",
    "ConcurrentIndex",
    "IndexGeneration",
    # Deletion
    "DeletionBitmap",
    "DeletionTracker",
    # Doc values
    "DocValueType",
    "NumericDocValues",
    "BinaryDocValues",
    "SortedDocValues",
    "SortedSetDocValues",
    "DocValuesStore",
    # Warmup
    "IndexWarmer",
    "WarmupConfig",
    "WarmupStats",
    # Vector store
    "VectorStore",
    # Filtered search
    "FilterExpression",
    "FieldCondition",
    "And",
    "Or",
    "Not",
    # Write-Ahead Log
    "WriteAheadLog",
    "WALConfig",
    "WALEntry",
    "WALOperation",
    "SyncMode",
]
