| | |
| | |
| | |
| | |
| | |
| | |
| | export declare function isClusterAvailable(): boolean; |
| | export interface ClusterNode { |
| | id: string; |
| | address: string; |
| | role: 'leader' | 'follower' | 'candidate'; |
| | status: 'healthy' | 'unhealthy' | 'unknown'; |
| | lastHeartbeat: number; |
| | } |
| | export interface ShardInfo { |
| | id: number; |
| | range: [number, number]; |
| | node: string; |
| | size: number; |
| | status: 'active' | 'migrating' | 'offline'; |
| | } |
| | export interface ClusterConfig { |
| | nodeId: string; |
| | address: string; |
| | peers?: string[]; |
| | shards?: number; |
| | replicationFactor?: number; |
| | } |
| | |
| | |
| | |
| | export declare class RuvectorCluster { |
| | private inner; |
| | private nodeId; |
| | private isLeader; |
| | constructor(config: ClusterConfig); |
| | |
| | |
| | |
| | start(): Promise<void>; |
| | |
| | |
| | |
| | stop(): Promise<void>; |
| | |
| | |
| | |
| | join(peerAddress: string): Promise<boolean>; |
| | |
| | |
| | |
| | leave(): Promise<void>; |
| | |
| | |
| | |
| | getNodeInfo(): ClusterNode; |
| | |
| | |
| | |
| | getNodes(): ClusterNode[]; |
| | |
| | |
| | |
| | isClusterLeader(): boolean; |
| | |
| | |
| | |
| | getLeader(): ClusterNode | null; |
| | |
| | |
| | |
| | put(key: string, value: any): Promise<boolean>; |
| | |
| | |
| | |
| | get(key: string): Promise<any | null>; |
| | |
| | |
| | |
| | delete(key: string): Promise<boolean>; |
| | |
| | |
| | |
| | compareAndSwap(key: string, expected: any, newValue: any): Promise<boolean>; |
| | |
| | |
| | |
| | getShards(): ShardInfo[]; |
| | |
| | |
| | |
| | getShardForKey(key: string): ShardInfo; |
| | |
| | |
| | |
| | rebalance(): Promise<void>; |
| | |
| | |
| | |
| | lock(name: string, timeout?: number): Promise<string | null>; |
| | |
| | |
| | |
| | unlock(name: string, token: string): Promise<boolean>; |
| | |
| | |
| | |
| | extendLock(name: string, token: string, extension?: number): Promise<boolean>; |
| | |
| | |
| | |
| | subscribe(channel: string, callback: (message: any) => void): () => void; |
| | |
| | |
| | |
| | publish(channel: string, message: any): Promise<number>; |
| | |
| | |
| | |
| | registerAgent(agentId: string, capabilities: string[]): Promise<boolean>; |
| | |
| | |
| | |
| | findAgents(capability: string): Promise<string[]>; |
| | |
| | |
| | |
| | assignTask(taskId: string, agentId: string, task: any): Promise<boolean>; |
| | |
| | |
| | |
| | completeTask(taskId: string, result: any): Promise<boolean>; |
| | |
| | |
| | |
| | stats(): { |
| | nodes: number; |
| | shards: number; |
| | leader: string | null; |
| | healthy: boolean; |
| | }; |
| | } |
| | |
| | |
| | |
| | export declare function createCluster(config: ClusterConfig): RuvectorCluster; |
| | export default RuvectorCluster; |
| | |