feat: progressive init and readiness API for cloud storage
- Add `initMode` option to all cloud storage adapters (GCS, S3, Azure) - 'auto' (default): progressive in cloud, strict locally - 'progressive': <200ms cold starts, lazy bucket validation - 'strict': blocking validation (current behavior) - Add cloud environment auto-detection for: - Cloud Run (K_SERVICE, K_REVISION) - AWS Lambda (AWS_LAMBDA_FUNCTION_NAME) - Cloud Functions (FUNCTIONS_TARGET) - Azure Functions (AZURE_FUNCTIONS_ENVIRONMENT) - Add readiness API to Brainy class: - `brain.ready`: Promise that resolves when init() completes - `brain.isFullyInitialized()`: checks if background tasks done - `brain.awaitBackgroundInit()`: waits for background tasks - Lazy bucket validation on first write (not during init) - Background count synchronization - Update AWS/GCP deployment docs with readiness patterns 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
19c5e67035
commit
d938a6bd4f
10 changed files with 1470 additions and 62 deletions
|
|
@ -17,6 +17,28 @@ export interface BrainyInterface<T = unknown> {
|
|||
*/
|
||||
init(): Promise<void>
|
||||
|
||||
/**
|
||||
* Promise that resolves when initialization is complete (v7.3.0+)
|
||||
* Can be awaited multiple times safely.
|
||||
*/
|
||||
readonly ready: Promise<void>
|
||||
|
||||
/**
|
||||
* Check if basic initialization is complete
|
||||
*/
|
||||
readonly isInitialized: boolean
|
||||
|
||||
/**
|
||||
* Check if all initialization including background tasks is complete (v7.3.0+)
|
||||
*/
|
||||
isFullyInitialized(): boolean
|
||||
|
||||
/**
|
||||
* Wait for all background initialization tasks to complete (v7.3.0+)
|
||||
* For cloud storage adapters, this waits for bucket validation and count sync.
|
||||
*/
|
||||
awaitBackgroundInit(): Promise<void>
|
||||
|
||||
/**
|
||||
* Modern add method - unified entity creation
|
||||
* @param params Parameters for adding entities
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue