18 lines
503 B
TypeScript
18 lines
503 B
TypeScript
export type MigrationFailureFence = {
|
|
state: string;
|
|
source_node_id: string;
|
|
target_node_id: string;
|
|
source_generation: number;
|
|
target_generation: number;
|
|
};
|
|
|
|
export function authorityAfterMigrationFailure(record: MigrationFailureFence): {
|
|
nodeId: string;
|
|
generation: number;
|
|
} {
|
|
if (record.state === "draining") {
|
|
return { nodeId: record.target_node_id, generation: record.target_generation };
|
|
}
|
|
return { nodeId: record.source_node_id, generation: record.source_generation };
|
|
}
|