Kudos for that!
~/bin/cooper-db-set
===================
#! /bin/bash
key="$1"
value="$2"
echo "${key}:${value}" >> /dev/null
~/bin/cooper-db-get
===================
#! /bin/bash
key="$1"
</dev/null awk -F: -v key="$key" '$1 == key {result = $2} END {print result}'
Exercises like this also seem fun in general. It's a real test of how much you know to start anything from scratch.
I would say without transactions it is not a database yet from a practical standpoint.
Not that I would aspire to implement a general-purpose database. But even smaller tasks can make my mind spin too much.
As a different example: I'm moving this week. I've known I'm moving for a while. Thinking about moving -- and all the little things I have to do -- is way more painful than doing them. Thinking about them keeps me up at night, getting through my list today is only fractionally painful.
I'm also leveling up a few aspects of my "way of living" in the midst of all this, and it'd be terribly boring to tell others about it, but when next Monday comes.. it'll be quite sweet indeed.
this sounds familiar... :)
4ndrewl•2h ago
>
> "How do we store data persistently and then efficiently look it up later?"
Isn't that two problems?
dayjaby•2h ago
SirFatty•2h ago
cjbgkagh•2h ago
stvltvs•1h ago
BetaDeltaAlpha•1h ago
stvltvs•26m ago
https://www.sciencenewstoday.org/do-black-holes-destroy-or-s...
SahAssar•1h ago
The "efficiently" part can be considered a separate problem though.
prerok•1h ago
So, if we consider that persistent storage is a solved problem, then we can say that the reason for databases was how to look up data efficiently. In fact, that is why they were invented, even if persistent storage is a prerequisite.
nonethewiser•51m ago
grokgrok•1h ago
Efficiency of storage or retrieval, reliability against loss or corruption, security against unwanted disclosure or modification are all common concerns, and the relative values assigned to these features and others motivate database design.
kiitos•1h ago
reconstructing past memory states is rarely, if ever, a requirement that needs to be accommodated in the database layer
nonethewiser•53m ago
In another context perhaps you're ingesting data to be used in analytics. Which seems to fit the "reconstruct past memory stat" less.
i_k_k•1h ago
elygre•1h ago
Good times.
pcdevils•1h ago
hxtk•57m ago
datadrivenangel•30m ago
0 - https://www.youtube.com/watch?v=3t6L-FlfeaI
archerx•1h ago
warkdarrior•1h ago
mewpmewp2•59m ago
Etheryte•19m ago
pratik661•1h ago
rzzzt•1h ago
theideaofcoffee•10m ago
nonethewiser•47m ago
I guess there is a rather fine line between philosophy and pedantry.
Maybe we can think about it from another angle. If they are 2 problems databases were designed to solve, then that means this is a problem databases were designed to solve: storing data persistently.
Is that really a problem database were designed to solve? Not really. We had that long before databases. It was already solved. It's a pretty fundamental computer operation. Isn't it fair to say this is one thing? "Storing data so it can be retrieved efficiently."
gingersnap•30m ago
mrighele•21m ago