diff --git a/README.md b/README.md index 8cf21ee3..e8d0f84b 100644 --- a/README.md +++ b/README.md @@ -543,12 +543,28 @@ await brain.import('research.pdf') // PDF with table extraction ```javascript // Single node (default) const brain = new Brainy({ - storage: {type: 's3', options: {bucket: 'my-data'}} + storage: { + type: 's3', + s3Storage: { + bucketName: 'my-data', + region: 'us-east-1', + accessKeyId: process.env.AWS_ACCESS_KEY_ID, + secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY + } + } }) // Distributed cluster - just add one flag! const brain = new Brainy({ - storage: {type: 's3', options: {bucket: 'my-data'}}, + storage: { + type: 's3', + s3Storage: { + bucketName: 'my-data', + region: 'us-east-1', + accessKeyId: process.env.AWS_ACCESS_KEY_ID, + secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY + } + }, distributed: true // That's it! Everything else is automatic }) ``` @@ -568,7 +584,15 @@ import { Brainy, NounType } from '@soulcraft/brainy' // Ingestion nodes (optimized for writes) const ingestionNode = new Brainy({ - storage: {type: 's3', options: {bucket: 'social-data'}}, + storage: { + type: 's3', + s3Storage: { + bucketName: 'social-data', + region: 'us-east-1', + accessKeyId: process.env.AWS_ACCESS_KEY_ID, + secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY + } + }, distributed: true, writeOnly: true // Optimized for high-throughput writes }) @@ -585,7 +609,15 @@ blueskyStream.on('post', async (post) => { // Search nodes (optimized for queries) const searchNode = new Brainy({ - storage: {type: 's3', options: {bucket: 'social-data'}}, + storage: { + type: 's3', + s3Storage: { + bucketName: 'social-data', + region: 'us-east-1', + accessKeyId: process.env.AWS_ACCESS_KEY_ID, + secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY + } + }, distributed: true, readOnly: true // Optimized for fast queries }) diff --git a/src/storage/storageFactory.ts b/src/storage/storageFactory.ts index 788c101e..4780303a 100644 --- a/src/storage/storageFactory.ts +++ b/src/storage/storageFactory.ts @@ -306,12 +306,13 @@ export async function createStorage( ) return new MemoryStorage() } - console.log('Using file system storage (forced)') + const fsPath = getFileSystemPath(options) + console.log(`Using file system storage (forced): ${fsPath}`) try { const { FileSystemStorage } = await import( './adapters/fileSystemStorage.js' ) - return new FileSystemStorage(getFileSystemPath(options)) + return new FileSystemStorage(fsPath) } catch (error) { console.warn( 'Failed to load FileSystemStorage, falling back to memory storage:', @@ -359,12 +360,13 @@ export async function createStorage( ) return new MemoryStorage() } - console.log('Using file system storage') + const fsPath = getFileSystemPath(options) + console.log(`Using file system storage: ${fsPath}`) try { const { FileSystemStorage } = await import( './adapters/fileSystemStorage.js' ) - return new FileSystemStorage(getFileSystemPath(options)) + return new FileSystemStorage(fsPath) } catch (error) { console.warn( 'Failed to load FileSystemStorage, falling back to memory storage:', @@ -538,12 +540,13 @@ export async function createStorage( process.versions && process.versions.node ) { - console.log('Using file system storage (auto-detected)') + const fsPath = getFileSystemPath(options) + console.log(`Using file system storage (auto-detected): ${fsPath}`) try { const { FileSystemStorage } = await import( './adapters/fileSystemStorage.js' ) - return new FileSystemStorage(getFileSystemPath(options)) + return new FileSystemStorage(fsPath) } catch (fsError) { console.warn( 'Failed to load FileSystemStorage, falling back to memory storage:',