Skip to content

Commit

Permalink
Stub additional methods for further consideration
Browse files Browse the repository at this point in the history
  • Loading branch information
TSampley committed Oct 5, 2024
1 parent b1419dc commit c36807b
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ interface DocumentGraphDatabase {
* optional parent. The parent type must be registered before the child type. Child properties
* can not conflict with parent properties.
*
* TODO: allow specifying defaults?
*
* @param name The name of the type.
* @param properties The properties of the type.
* @param parent The parent type of the new type.
Expand All @@ -48,6 +50,8 @@ interface DocumentGraphDatabase {
*/
suspend fun createDocument(type: DocumentType, attributes: Map<String, Any>): Result<Document>

suspend fun createDocuments() // TODO:

/**
* Creates a relation between two documents.
*
Expand All @@ -57,6 +61,8 @@ interface DocumentGraphDatabase {
*/
suspend fun createRelation(from: Uuid, to: Uuid, type: Uuid, label: Any): Result<Relation>

suspend fun createRelations() // TODO:

/**
* Create a new edge between two documents.
*/
Expand Down Expand Up @@ -116,13 +122,17 @@ interface DocumentGraphDatabase {
*/
suspend fun removeRelation(id: Uuid)

suspend fun removeRelations() // TODO:

/**
* Removes all documents of a given type from the database.
*
* @param type The UUID of the type.
*/
suspend fun removeDocumentsOfType(type: Uuid)

suspend fun removeDocuments() // TODO:

/**
* Removes all relations of a given type from the database.
*
Expand All @@ -142,4 +152,20 @@ interface DocumentGraphDatabase {
* @param id The UUID of the document.
*/
suspend fun removeDocument(id: Uuid): Result<Unit>

// region Advanced

suspend fun filterDocuments(type: Uuid, filter: (Document) -> Boolean): List<Document>

suspend fun filterRelations(type: Uuid, filter: (Relation) -> Boolean): List<Relation>

suspend fun traverseBfs(start: Uuid, type: Uuid, maxDepth: Int): List<Document>
suspend fun traverseDfs(start: Uuid, type: Uuid, maxDepth: Int): List<Document>

interface StructuralQuery
suspend fun findMatching(query: StructuralQuery): List<Document>

// endregion
}

// TODO: add more exception types for helpful errors

0 comments on commit c36807b

Please sign in to comment.