import { Bucket, Cluster, DropQueryIndexOptions } from 'couchbase';
import { PartitionStrategy } from './configuration';
import { Version } from './feature-versions';
export declare const DEFAULT_SCOPE = "_default";
export declare const DEFAULT_COLLECTION = "_default";
export type TickHandler = (timePassed: number) => void;
export interface WithClause {
    action?: string;
    num_replica?: number;
    nodes?: string[];
    num_partition?: number;
    retain_deleted_xattr?: boolean;
}
export interface WaitForIndexBuildOptions {
    timeoutMs?: number;
    scope?: string;
    collection?: string;
}
interface SystemIndex {
    id: string;
    name: string;
    bucket_id?: string;
    scope_id?: string;
    namespace_id: string;
    keyspace_id: string;
    is_primary?: boolean;
    index_key: string[];
    condition?: string;
    partition?: string;
    state: string;
    using: string;
}
export interface CouchbaseIndex extends Omit<SystemIndex, "bucket_id" | "namespace_id" | "scope_id" | "keyspace_id"> {
    scope: string;
    collection: string;
    num_replica: number;
    num_partition: number;
    nodes: string[];
    retain_deleted_xattr: boolean;
}
export interface CreateIndexPlanKey {
    expr: string;
    desc?: boolean;
}
interface IndexCreatePlanUnnormalized {
    keys?: CreateIndexPlanKey[] | string[];
    where?: string;
    partition?: {
        exprs: string[];
        strategy: PartitionStrategy;
    };
}
/**
 * Subset of fields returned on a query plan for CREATE INDEX
 */
export interface IndexCreatePlan extends IndexCreatePlanUnnormalized {
    keys?: CreateIndexPlanKey[];
}
export declare function getKeyspace(bucket: string, scope?: string, collection?: string): string;
/**
 * Manages Couchbase indexes
 */
export declare class IndexManager {
    private bucket;
    private cluster;
    readonly isSecure: boolean;
    private manager;
    /**
     * @param {Bucket} bucket
     * @param {Cluster} cluster
     */
    constructor(bucket: Bucket, cluster: Cluster, isSecure?: boolean);
    /**
     * Get the name of the bucket being managed
     */
    get bucketName(): string;
    /**
     * Gets all indexes using a query
     * Workaround until https://issues.couchbase.com/projects/JSCBC/issues/JSCBC-772 is resolved
     */
    private getAllIndexes;
    /**
     * Gets index statuses for the bucket via the cluster manager
     */
    private getIndexStatuses;
    getIndexes(scope?: string, collection?: string): Promise<CouchbaseIndex[]>;
    /**
     * Creates an index based on an index definition
     */
    createIndex(statement: string): Promise<void>;
    private getAlterStatement;
    /**
     * Moves index replicas been nodes
     */
    moveIndex(indexName: string, scope: string, collection: string, nodes: string[]): Promise<void>;
    /**
     * Moves index replicas been nodes
     */
    resizeIndex(indexName: string, scope: string, collection: string, numReplica: number, nodes?: string[]): Promise<void>;
    /**
     * Builds any outstanding deferred indexes on the bucket
     */
    buildDeferredIndexes(scope?: string, collection?: string): Promise<string[]>;
    /**
     * Monitors building indexes and triggers a Promise when complete
     */
    waitForIndexBuild(options: WaitForIndexBuildOptions, tickHandler: TickHandler): Promise<boolean>;
    /**
     * Drops an existing index
     */
    dropIndex(indexName: string, scope?: string, collection?: string, options?: DropQueryIndexOptions): Promise<void>;
    /**
     * Gets the version of the cluster
     */
    getClusterVersion(): Promise<Version>;
    /**
     * Uses EXPLAIN to get a query plan for a statement
     */
    getQueryPlan(statement: string): Promise<IndexCreatePlan>;
}
export {};
