JOH*_*OHN 4 database cassandra
我想开发一个分层数据库来存储文件系统中的目录结构.
就像
Root
-dir
-subdir
-subdir
-subdir
-subdir
-subdir
-subdir
-subdir
我可以使用Apache Cassandra吗?
一个java示例将更好地理解.
您可以在列系列中存储路径的数据,类型和父级,
paths { #colum family
"/some/path" { # key
"type" : "file|directory" #column, either file or directory, if this is a file or a directory
"data" : "??" # if this is a file, the data for the file. you don't want to be storing very large files in cassandra in one column
}
}
Run Code Online (Sandbox Code Playgroud)
使用cassandra,您需要进行非规范化以提供您要执行的查询.你可能想查询一个目录的子节点,所以有一个像这样的结构,
children { #column family
"/some/path" { # key
"child-path-1" : null #column, one for each child of /some/path
"child-path-2" : null
}
}
Run Code Online (Sandbox Code Playgroud)
添加更多列系列以支持您希望执行的其他查询.