"I'm gonna put some sand in Cassandra's eye."
Custom Implementation of Apache Cassandra DB for SUTD ISTD 2022 50.041: Distributed Systems and Computing Group Project.
sanddb/
├─ anti_entropy/
├─ client/
├─ config/
├─ data/
├─ db/
├─ messages/
├─ read_write/
├─ ring-visualiser/
├─ utils/
├─ main.go
Note: both partition keys and clustering keys are required since they form the primary key.
HTTP Method
POST
URL
http://localhost:<port>/create/
Request Body:
{
"table_name": "hospitals",
"partition_key_names": ["HOSPITAL_ID", "DEPARTMENT"],
"clustering_key_names": ["ROOM_ID"]
}
- table_name: name of the table to be inserted/updated
- partition_key_names: headers of the partition keys
- clustering_key_names: headers of clustering keys
HTTP Method
POST
URL
http://localhost:<port>/insert/
Request Body:
{
"table_name": "hospitals",
"partition_keys": ["1", "GENERAL"],
"clustering_keys": ["AA-1"],
"cell_names": ["Bed", "Oxygen Tank"],
"cell_values": ["3", "10"]
}
- table_name: name of the table to be inserted/updated
- partition_keys: values of the partition keys
- clustering_keys: values of the clustering keys
- cell_names: column headers to be added into the row
- cell_values: values of the columns to be added into the row
HTTP Method
POST
URL
http://localhost:<port>/read/
Request Body
{
"table_name": "hospitals",
"partition_keys": ["1", "GENERAL"],
"clustering_keys": ["AA-1"]
}
Params:
- table_name: name of the table to be queried from
- partition_keys: values of the partition keys
- clustering_keys: values of the clustering keys (optional)
HTTP Method
POST
URL
http://localhost:<port>/delete/
Request Body
{
"table_name": "hospitals",
"partition_keys": ["1", "GENERAL"],
"clustering_keys": ["AA-1"]
}
Params:
- table_name: name of the table to remove an entry from
- partition_keys: values of the partition keys of the row to be deleted
- clustering_keys: values of the clustering keys of the row to be deleted
table_name.json
:
type Table []Partition
type Partition struct {
Metadata PartitionMetadata `json:"partition_metadata"`
Rows []Row `json:"rows"`
}
type PartitionMetadata struct {
TableName string `json:"table_name"`
PartitionKey int64 `json:"partition_key"`
PartitionKeyNames []string `json:"partition_key_names"`
PartitionKeyValues []string `json:"partition_key_values"`
ClusteringKeyNames []string `json:"clustering_key_names"`
}
type Row struct {
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
ClusteringKeyHash int64 `json:"clustering_key_hash"`
ClusteringKeyValues []string `json:"clustering_key_values"`
Cells []Cell `json:"cells"`
}
type Cell struct {
Name string `json:"name"`
Value string `json:"value"`
}
For future work in implementing the entire full Merkle Tree, as well as its comparisons, these repositories might be useful:
Credits and thanks to:
- Group 5 Team Members:
- 50.041 Course Instructor: Professor Sudipta Chattopadhyay