Mercurial
annotate asyncio_threads/database/README.md @ 74:4b96794c8d59
[Dowa] Added 64 type
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Wed, 31 Dec 2025 11:17:24 -0800 |
| parents | 46daba6e3cf4 |
| children |
| rev | line source |
|---|---|
|
48
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
1 # Design an in-memory key-value database that supports the following commands and fully handles nested transactions. |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
2 |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
3 ## Core Operations: |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
4 SET <key> <value>: Sets the value for a key. |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
5 |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
6 GET <key>: Returns the value for a key. |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
7 |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
8 UNSET <key>: Removes the key and its value. |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
9 |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
10 ## Transaction Operations: |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
11 BEGIN: Starts a new transaction scope. If a transaction is already active, this starts a nested transaction. |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
12 |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
13 COMMIT: Applies all changes made in the current transaction scope and all its active nested transactions to the parent scope (or to the main database state if no parent exists). After a successful commit, the transaction scope is closed. |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
14 |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
15 ROLLBACK: Discards all changes made in the current transaction scope and all its active nested transactions, restoring the state to what it was when the BEGIN command was issued for the current scope. After a successful rollback, the transaction scope is closed. |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
16 |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
17 ## Implementation Goal: |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
18 |
|
46daba6e3cf4
Few python scrtips to show how to use asychio.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
19 Design the primary data structures and outline the logic for SET, COMMIT, and ROLLBACK to ensure nested transactions operate correctly. Explain how the state of the database is managed across multiple transaction layers. |