import { compareThings } from './model';
import { AVLTreeWrapper } from './avl-tree-wrapper';
/**
 * Two indexed pointers are equal iif they point to the same place
 */
declare function checkValueEquality(a: any, b: any): boolean;
type Options = {
    fieldName: string;
    unique?: boolean;
    sparse?: boolean;
};
export declare class Index {
    fieldName: string;
    unique: boolean;
    sparse: boolean;
    treeOptions: {
        unique: boolean;
        compareKeys: typeof compareThings;
        checkValueEquality: typeof checkValueEquality;
    };
    tree: AVLTreeWrapper;
    /**
     * Create a new index
     * All methods on an index guarantee that either the whole operation was successful and the index changed
     * or the operation was unsuccessful and an error is thrown while the index is unchanged
     * @param {String} options.fieldName On which field should the index apply (can use dot notation to index on sub fields)
     * @param {Boolean} options.unique Optional, enforce a unique constraint (default: false)
     * @param {Boolean} options.sparse Optional, allow a sparse index (we can have documents for which fieldName is undefined) (default: false)
     */
    constructor(options?: Options);
    /**
     * Reset an index
     * @param {Document or Array of documents} newData Optional, data to initialize the index with
     *                                                 If an error is thrown during insertion, the index is not modified
     */
    reset(newData?: any): void;
    /**
     * Insert a new document in the index
     * If an array is passed, we insert all its elements (if one insertion fails the index is not modified)
     * O(log(n))
     */
    insert(doc: any): void;
    /**
     * Insert an array of documents in the index
     * If a constraint is violated, the changes should be rolled back and an error thrown
     *
     * @API private
     */
    insertMultipleDocs(docs: any): void;
    /**
     * Remove a document from the index
     * If an array is passed, we remove all its elements
     * The remove operation is safe with regards to the 'unique' constraint
     * O(log(n))
     */
    remove(doc: any): void;
    /**
     * Update a document in the index
     * If a constraint is violated, changes are rolled back and an error thrown
     * Naive implementation, still in O(log(n))
     */
    update(oldDoc: any, newDoc?: any): void;
    /**
     * Update multiple documents in the index
     * If a constraint is violated, the changes need to be rolled back
     * and an error thrown
     * @param {Array of oldDoc, newDoc pairs} pairs
     *
     * @API private
     */
    updateMultipleDocs(pairs: any): void;
    /**
     * Revert an update
     */
    revertUpdate(oldDoc: any, newDoc?: any): void;
    /**
     * Get all documents in index whose key match value (if it is a Thing) or one of the elements of value (if it is an array of Things)
     */
    getMatching(value: any): any[];
    /**
     * Get all documents in index whose key is between bounds are they are defined by query
     * Documents are sorted by key
     * @param {Query} query
     * @return {Array of documents}
     */
    getBetweenBounds(query: any): any[];
    /**
     * Get all elements in the index
     * @return {Array of documents}
     */
    getAll(): any[];
}
export {};
