**docs: remove outdated statistics-related documentation and add standards**
- **Removed Files**: - Deleted outdated statistics documentation files (`statistics.md`, `statistics-flush-solution.md`, `statistics-summary.md`) to clean up the repository and avoid confusion. - **Added Standards**: - Introduced `DOCUMENTATION_STANDARDS.md` to outline naming conventions and troubleshooting practices for more consistent and maintainable project documentation. - **Tests**: - Added a new test file `edge-cases.test.ts` to verify handling of edge cases, ensuring robust behavior against boundary values and invalid inputs. **Purpose**: Cleans up deprecated documentation while introducing concrete standards for maintaining and updating documentation. Enhances test coverage for unusual or boundary inputs, improving overall system resilience.
This commit is contained in:
parent
3337c9f78e
commit
94c88e128c
41 changed files with 5583 additions and 498 deletions
|
|
@ -3,13 +3,14 @@
|
|||
* File system storage adapter for Node.js environments
|
||||
*/
|
||||
|
||||
import { GraphVerb, HNSWNoun } from '../../coreTypes.js'
|
||||
import { GraphVerb, HNSWNoun, StatisticsData } from '../../coreTypes.js'
|
||||
import {
|
||||
BaseStorage,
|
||||
NOUNS_DIR,
|
||||
VERBS_DIR,
|
||||
METADATA_DIR,
|
||||
INDEX_DIR
|
||||
INDEX_DIR,
|
||||
STATISTICS_KEY
|
||||
} from '../baseStorage.js'
|
||||
|
||||
// Type aliases for better readability
|
||||
|
|
@ -585,4 +586,106 @@ export class FileSystemStorage extends BaseStorage {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of abstract methods from BaseStorage
|
||||
*/
|
||||
|
||||
/**
|
||||
* Save a noun to storage
|
||||
*/
|
||||
protected async saveNoun_internal(noun: HNSWNoun): Promise<void> {
|
||||
return this.saveNode(noun)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a noun from storage
|
||||
*/
|
||||
protected async getNoun_internal(id: string): Promise<HNSWNoun | null> {
|
||||
return this.getNode(id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all nouns from storage
|
||||
*/
|
||||
protected async getAllNouns_internal(): Promise<HNSWNoun[]> {
|
||||
return this.getAllNodes()
|
||||
}
|
||||
|
||||
/**
|
||||
* Get nouns by noun type
|
||||
*/
|
||||
protected async getNounsByNounType_internal(nounType: string): Promise<HNSWNoun[]> {
|
||||
return this.getNodesByNounType(nounType)
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a noun from storage
|
||||
*/
|
||||
protected async deleteNoun_internal(id: string): Promise<void> {
|
||||
return this.deleteNode(id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a verb to storage
|
||||
*/
|
||||
protected async saveVerb_internal(verb: GraphVerb): Promise<void> {
|
||||
return this.saveEdge(verb)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a verb from storage
|
||||
*/
|
||||
protected async getVerb_internal(id: string): Promise<GraphVerb | null> {
|
||||
return this.getEdge(id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all verbs from storage
|
||||
*/
|
||||
protected async getAllVerbs_internal(): Promise<GraphVerb[]> {
|
||||
return this.getAllEdges()
|
||||
}
|
||||
|
||||
/**
|
||||
* Get verbs by source
|
||||
*/
|
||||
protected async getVerbsBySource_internal(sourceId: string): Promise<GraphVerb[]> {
|
||||
return this.getEdgesBySource(sourceId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get verbs by target
|
||||
*/
|
||||
protected async getVerbsByTarget_internal(targetId: string): Promise<GraphVerb[]> {
|
||||
return this.getEdgesByTarget(targetId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get verbs by type
|
||||
*/
|
||||
protected async getVerbsByType_internal(type: string): Promise<GraphVerb[]> {
|
||||
return this.getEdgesByType(type)
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a verb from storage
|
||||
*/
|
||||
protected async deleteVerb_internal(id: string): Promise<void> {
|
||||
return this.deleteEdge(id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Save statistics data to storage
|
||||
*/
|
||||
protected async saveStatisticsData(statistics: StatisticsData): Promise<void> {
|
||||
await this.saveMetadata(STATISTICS_KEY, statistics)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get statistics data from storage
|
||||
*/
|
||||
protected async getStatisticsData(): Promise<StatisticsData | null> {
|
||||
return this.getMetadata(STATISTICS_KEY)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,10 @@ export class MemoryStorage extends BaseStorage {
|
|||
connections: new Map(),
|
||||
sourceId: verb.sourceId,
|
||||
targetId: verb.targetId,
|
||||
type: verb.type,
|
||||
source: verb.sourceId || verb.source,
|
||||
target: verb.targetId || verb.target,
|
||||
verb: verb.type || verb.verb,
|
||||
type: verb.type || verb.verb,
|
||||
weight: verb.weight,
|
||||
metadata: verb.metadata
|
||||
}
|
||||
|
|
@ -204,6 +207,7 @@ export class MemoryStorage extends BaseStorage {
|
|||
source: (verb.sourceId || verb.source || ""),
|
||||
target: (verb.targetId || verb.target || ""),
|
||||
verb: verb.type || verb.verb,
|
||||
type: verb.type || verb.verb, // Ensure type is also set
|
||||
weight: verb.weight,
|
||||
metadata: verb.metadata,
|
||||
createdAt: verb.createdAt || defaultTimestamp,
|
||||
|
|
@ -388,4 +392,4 @@ export class MemoryStorage extends BaseStorage {
|
|||
// Since this is in-memory, there's no need for fallback mechanisms
|
||||
// to check multiple storage locations
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue