75 lines
2.5 KiB
Markdown
75 lines
2.5 KiB
Markdown
# Disk Storage System
|
|
|
|
We use the disk instead of a database to reduce complexity. We leave the hard
|
|
optimization to the filesystem layer.
|
|
|
|
## API
|
|
|
|
`collection.create(T)` - creates an object of type T, saving it to the disk
|
|
`collection.get(id) : T` - gets an object of type T based on the id field configured
|
|
`collection.update(T)` - updates an object of type T, saving it to the disk
|
|
`collection.delete(T)` - removes an object from the system and the disk
|
|
`collection.find(criteria)` - find all objects that match the criteria *that have an index*
|
|
|
|
## CLI
|
|
|
|
```
|
|
[you@machine:~/] fsdb users create '{
|
|
"id": "able-fish-door-with-star-snow-idea-edge-salt-many",
|
|
"email": "commandlinetestuser@domain.com",
|
|
"phone": "213-555-1234",
|
|
"value": "By the way a horse is a lemon from the right perspective."
|
|
}'
|
|
created: {
|
|
"id": "able-fish-door-with-star-snow-idea-edge-salt-many",
|
|
"email": "commandlinetestuser@domain.com",
|
|
"phone": "213-555-1234",
|
|
"value": "By the way a horse is a lemon from the right perspective."
|
|
}
|
|
|
|
[you@machine:~/] fsdb users update '{
|
|
"id": "able-fish-door-with-star-snow-idea-edge-salt-many",
|
|
"email": "commandlinetestuser@domain.com",
|
|
"phone": "213-555-1234",
|
|
"value": "By the way a horse is a lemon from the right angle."
|
|
}'
|
|
updated: {
|
|
"id": "able-fish-door-with-star-snow-idea-edge-salt-many",
|
|
"email": "commandlinetestuser@domain.com",
|
|
"phone": "213-555-1234",
|
|
"value": "By the way a horse is a lemon from the right angle."
|
|
}
|
|
|
|
[you@machine:~/] fsdb users get able-fish-door-with-star-snow-idea-edge-salt-many
|
|
{
|
|
"id": "able-fish-door-with-star-snow-idea-edge-salt-many",
|
|
"email": "commandlinetestuser@domain.com",
|
|
"phone": "213-555-1234",
|
|
"value": "By the way a horse is a lemon from the right angle."
|
|
}
|
|
|
|
[you@machine:~/] fsdb users delete '{
|
|
"id": "able-fish-door-with-star-snow-idea-edge-salt-many",
|
|
"email": "commandlinetestuser@domain.com",
|
|
"phone": "213-555-1234",
|
|
"value": "By the way a horse is a lemon from the right angle."
|
|
}'
|
|
deleted: {
|
|
"id": "able-fish-door-with-star-snow-idea-edge-salt-many",
|
|
"email": "commandlinetestuser@domain.com",
|
|
"phone": "213-555-1234",
|
|
"value": "By the way a horse is a lemon from the right angle."
|
|
}
|
|
```
|
|
|
|
## Indexers
|
|
|
|
### Symlinks
|
|
|
|
We create symlinks on the disk to help find objects more quickly and to allow
|
|
for browsing the data as a human.
|
|
|
|
### SQLite
|
|
|
|
TODO: index everything into a sqlite setup as well? would give a way to run
|
|
SQL against data still stored on disk in a nicely human browsable format.
|