The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
parcel KinoSearch cnick Kino;

/** Read a segment's sort caches.
 */
abstract class KinoSearch::Index::SortReader 
    inherits KinoSearch::Index::DataReader {

    inert SortReader*
    init(SortReader *self, Schema *schema = NULL, Folder *folder = NULL,
         Snapshot *snapshot = NULL, VArray *segments = NULL,
         int32_t seg_tick = -1);

    abstract nullable SortCache*
    Fetch_Sort_Cache(SortReader *self, const CharBuf *field);

    /** Returns NULL, since multi-segment sort caches cannot be produced by
     * the default implementation.
     */
    public incremented nullable DataReader*
    Aggregator(SortReader *self, VArray *readers, I32Array *offsets);
    
}

class KinoSearch::Index::DefaultSortReader cnick DefSortReader 
    inherits KinoSearch::Index::SortReader {

    Hash *caches;
    Hash *counts;
    Hash *null_ords;
    Hash *ord_widths;
    int32_t format;

    inert incremented DefaultSortReader*
    new(Schema *schema, Folder *folder, Snapshot *snapshot, VArray *segments,
        int32_t seg_tick);

    inert DefaultSortReader*
    init(DefaultSortReader *self, Schema *schema, Folder *folder, 
         Snapshot *snapshot, VArray *segments, int32_t seg_tick);

    nullable SortCache*
    Fetch_Sort_Cache(DefaultSortReader *self, const CharBuf *field);

    public void
    Close(DefaultSortReader *self);

    public void
    Destroy(DefaultSortReader *self);
}

/* Copyright 2006-2011 Marvin Humphrey
 *
 * This program is free software; you can redistribute it and/or modify
 * under the same terms as Perl itself.
 */