()
| 414 | } |
| 415 | |
| 416 | get stats() { |
| 417 | // When finalized, count all shard files from filesystem (for multi-process scenarios) |
| 418 | // Otherwise, count only files created by this instance |
| 419 | const shardFilesList = |
| 420 | this.#state === 'finalized' || this.#state === 'cleaned' |
| 421 | ? this.shardFiles() |
| 422 | : this.getCreatedShardFiles(); |
| 423 | |
| 424 | return { |
| 425 | lastRecovery: this.#lastRecovery, |
| 426 | state: this.#state, |
| 427 | groupId: this.groupId, |
| 428 | shardCount: shardFilesList.length, |
| 429 | isCoordinator: this.isCoordinator(), |
| 430 | isFinalized: this.isFinalized(), |
| 431 | isCleaned: this.isCleaned(), |
| 432 | finalFilePath: this.getFinalFilePath(), |
| 433 | shardFileCount: shardFilesList.length, |
| 434 | shardFiles: shardFilesList, |
| 435 | }; |
| 436 | } |
| 437 | |
| 438 | finalizeIfCoordinator(opt?: Record<string, unknown>) { |
| 439 | if (this.isCoordinator()) { |
nothing calls this directly
no test coverage detected