couchbase-index-manager
Version:
Manage Couchbase indexes during the CI/CD process
77 lines (76 loc) • 2.75 kB
TypeScript
import { IndexConfiguration, IndexConfigurationBase, Lifecycle, Partition, PostProcessHandler } from '../configuration';
import { Version } from '../feature-versions';
import { CouchbaseIndex, IndexManager, WithClause } from '../index-manager';
import { IndexMutation } from '../plan';
import { IndexDefinitionBase } from './index-definition-base';
export interface MutationContext {
currentIndexes: CouchbaseIndex[];
clusterVersion?: Version;
}
/**
* Represents an index
*/
export declare class IndexDefinition extends IndexDefinitionBase implements IndexConfigurationBase {
is_primary: boolean;
index_key: string[];
condition?: string;
partition?: Partition;
manual_replica: boolean;
num_replica: number;
nodes?: string[];
retain_deleted_xattr: boolean;
lifecycle?: Lifecycle;
post_process?: PostProcessHandler;
/**
* Creates a new IndexDefinition from a simple object map
*/
constructor(configuration: IndexConfiguration);
/**
* Creates a new IndexDefinition from a simple object map
*/
static fromObject(configuration: IndexConfiguration): IndexDefinition;
/**
* Apply overrides to the index definition
*/
applyOverride(override: IndexConfigurationBase, applyMissing?: boolean): void;
/**
* Gets the required index mutations, if any, to sync this definition
*/
getMutations(context: MutationContext): Iterable<IndexMutation>;
private getMutation;
private getWithClause;
/**
* Formats the PartitionHash as a string
*/
getPartitionString(): string;
/**
* Tests to see if a Couchbase index matches this definition
*/
private isMatch;
/**
* Tests to see if a Couchbase index requires updating,
* ignoring node changes which are handled separately.
*/
private requiresUpdate;
/**
* Normalizes the index definition using Couchbase standards
* for condition and index_key.
*/
normalize(manager: IndexManager): Promise<void>;
/**
* Formats a CREATE INDEX query which makes this index
*/
getCreateStatement(bucketName: string): string;
getCreateStatement(bucketName: string, withClause: WithClause): string;
getCreateStatement(bucketName: string, indexName: string, withClause?: WithClause): string;
/**
* Apply phases to the collection of index mutations
*/
private static phaseMutations;
/**
* Ensures that the node list has port numbers and is sorted in the same
* order as the current indexes. This allows easy matching of existing
* node assignments, reducing reindex load due to minor node shifts.
*/
normalizeNodeList(currentIndexes: CouchbaseIndex[]): void;
}