Notes on CAS and git.

c-declarations
Joshua Potter 2024-02-29 08:52:05 -07:00
parent 4ad55dc8bf
commit 2a7400a255
10 changed files with 326 additions and 13 deletions

View File

@ -89,7 +89,7 @@
"algorithms/index.md": "cd7c7ba91fb2f961c9f2437777e8e2ac",
"algorithms/sorting/index.md": "2d5a18a3079d96fa9e3d4289181a8b6c",
"algorithms/sorting/insertion-sort.md": "00e4edb132d473b0516fde3307ebae30",
"bash/index.md": "3dfeb538d781e4645e3aaaf32beb1034",
"bash/index.md": "3e4738d8d3531bb7a5afc53a2d73036c",
"bash/prompts.md": "61cb877e68da040a15b85af76b1f68ba",
"bash/quoting.md": "b1d8869a91001f8b22f0cdc54d806f61",
"bash/robustness.md": "7ab094b95ba2bfa885adba8e9efedf68",
@ -122,7 +122,7 @@
"_journal/2024-02-02.md": "a3b222daee8a50bce4cbac699efc7180",
"_journal/2024-02-01.md": "3aa232387d2dc662384976fd116888eb",
"_journal/2024-01-31.md": "7c7fbfccabc316f9e676826bf8dfe970",
"logic/equiv-trans.md": "4a781f0d21ee0942445cd31da3ec396f",
"logic/equiv-trans.md": "1f2d5823f128b8fdb526436e83a206ff",
"_journal/2024-02-07.md": "8d81cd56a3b33883a7706d32e77b5889",
"algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2",
"algorithms/loop-invariant.md": "29f9f9090a3109890d333a78acc18b50",
@ -190,7 +190,7 @@
"combinatorics/inclusion-exclusion.md": "ca5c967be774ce204f1ca47cc8df14b8",
"_journal/2024-02-21.md": "b9d944ecebe625da5dd72aeea6a916a2",
"_journal/2024-02/2024-02-20.md": "af2ef10727726200c4defe2eafc7d841",
"algebra/radices.md": "88c6c5657eca99f3d274f0c3fc0e3af0",
"algebra/radices.md": "4ffc8525f2b877c0d17e3359870797fe",
"_journal/2024-02-22.md": "e01f1d4bd2f7ac2a667cdfd500885a2a",
"_journal/2024-02/2024-02-21.md": "f423137ae550eb958378750d1f5e98c7",
"_journal/2024-02-23.md": "219ce9ad15a8733edd476c97628b71fd",
@ -208,8 +208,15 @@
"_journal/2024-02/2024-02-25.md": "426be827fe8483e4ab432304a2aa6df3",
"_journal/2024-02-27.md": "851180f1f7c1aaacd4c0b0ec2639bdf2",
"_journal/2024-02/2024-02-26.md": "417b84be5d96f9d8adcdedca3b68b141",
"_journal/2024-02-28.md": "3d69115853814aaff435b3a4c05f97b7",
"_journal/2024-02/2024-02-27.md": "f75a0d04a875aeee932343dae0c78768"
"_journal/2024-02-28.md": "7489377c014a2ff3c535d581961b5b82",
"_journal/2024-02/2024-02-27.md": "f75a0d04a875aeee932343dae0c78768",
"filesystems/index.md": "cbd2b0290a3ba3b32abec4bd8bfefad5",
"filesystems/cas.md": "34906013a2a60fe5ee0e31809b4838aa",
"git/objects.md": "b49015b8ebffc2c976d97b2484c74448",
"git/index.md": "83d2d95fc549d9e8436946c7bd058d15",
"encoding/integer.md": "5dd3a961bf259e53da207209051b8335",
"_journal/2024-02-29.md": "f610f3caed659c1de3eed5f226cab508",
"_journal/2024-02/2024-02-28.md": "7489377c014a2ff3c535d581961b5b82"
},
"fields_dict": {
"Basic": [

View File

@ -0,0 +1,21 @@
---
title: "2024-02-29"
---
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [x] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [ ] Log Work Hours (Max 3 hours)
* 101weiqi (serial numbers)
* Q-349924
* Q-99982
* Q-285489
* Q-85874
* Q-265576
* Q-11420
* TODO
* Watch database courses and read

View File

@ -5,10 +5,10 @@ title: "2024-02-28"
- [x] Anki Flashcards
- [x] KoL
- [ ] Sheet Music (10 min.)
- [ ] Go (1 Life & Death Problem)
- [x] Go (1 Life & Death Problem)
- [ ] Korean (Read 1 Story)
- [ ] Interview Prep (1 Practice Problem)
- [ ] Log Work Hours (Max 3 hours)
- [x] Log Work Hours (Max 3 hours)
* 101weiqi (serial numbers)
* Q-314990
@ -17,3 +17,5 @@ title: "2024-02-28"
* Q-51685
* Q-11821
* Q-5014
* Add notes on `SIGABRT`.
* First pass on "Git Internals" in "Pro Git".

View File

@ -276,7 +276,7 @@ END%%
%%ANKI
Basic
Which hexadecimal digits have a leading `1` bit?
Which hexadecimal digits encode binary with a leading `1` bit?
Back: `8` through `F`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
Tags: binary::hex
@ -285,7 +285,7 @@ END%%
%%ANKI
Basic
Which hexadecimal digits have a leading `0` bit?
Which hexadecimal digits encode binary with a leading `0` bit?
Back: `0` through `7`
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
Tags: binary::hex

View File

@ -126,8 +126,8 @@ END%%
%%ANKI
Basic
*Why* is it $UMax = 2 \cdot TMax + 1$?
Back: All bit strings representing negative numbers in two's-complement are positive in unsigned encoding.
Provide a combinatorial explanation on why $UMax$ equals $2 \cdot TMax + 1$.
Back: There is one more negative number than positive numbers represented in two's-complement.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1708613447880-->
END%%

103
notes/filesystems/cas.md Normal file
View File

@ -0,0 +1,103 @@
---
title: Content-Addressable Storage
TARGET DECK: Obsidian::STEM
FILE TAGS: fs::cas
tags:
- cas
- fs
---
## Overview
CAS (**c**ontent-**a**ddressed **s**torage) refers to storage that allows retrieval based on content (as opposed to name or location). Usually the contents of a file are passed through a cryptographic hash function to generate a key that can be used for subsequent retrieval.
%%ANKI
Basic
What is content-addressed storage?
Back: A method for storing information such that it can be retrieved based on its content.
Reference: “Content-Addressable Storage,” in _Wikipedia_, February 27, 2024, [https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681](https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681).
<!--ID: 1709177255543-->
END%%
%%ANKI
Basic
What is considered the "opposite" of content-addressed storage?
Back: Location-addressed storage.
Reference: “Content-Addressable Storage,” in _Wikipedia_, February 27, 2024, [https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681](https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681).
<!--ID: 1709177255547-->
END%%
%%ANKI
Basic
What is CAS an acronym for?
Back: **C**ontent-**a**ddressed **s**torage.
Reference: “Content-Addressable Storage,” in _Wikipedia_, February 27, 2024, [https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681](https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681).
<!--ID: 1709177255550-->
END%%
%%ANKI
Cloze
{1:Content}-addressed is to {2:URNs} whereas {2:location}-addressed is to {1:URLs}.
Reference: “Content-Addressable Storage,” in _Wikipedia_, February 27, 2024, [https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681](https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681).
<!--ID: 1709177255553-->
END%%
%%ANKI
Basic
Interpreted as a key-value store, what is a "key" in a CAS system?
Back: The digest produced when running content through a cryptographic hash function.
Reference: “Content-Addressable Storage,” in _Wikipedia_, February 27, 2024, [https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681](https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681).
<!--ID: 1709177255556-->
END%%
%%ANKI
Basic
Interpreted as a key-value store, what is a "value" in a CAS system?
Back: The actual content being stored.
Reference: “Content-Addressable Storage,” in _Wikipedia_, February 27, 2024, [https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681](https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681).
<!--ID: 1709177255559-->
END%%
%%ANKI
Basic
In the context of CAS, what is a "content address"?
Back: A digest produced when running content through a cryptographic hash function.
Reference: “Content-Addressable Storage,” in _Wikipedia_, February 27, 2024, [https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681](https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681).
<!--ID: 1709177255562-->
END%%
%%ANKI
Cloze
Content addresses are an alternative to {location} addresses found in traditional filesystems.
Reference: “Content-Addressable Storage,” in _Wikipedia_, February 27, 2024, [https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681](https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681).
<!--ID: 1709177255565-->
END%%
%%ANKI
Basic
Why are CAS systems sometimes called "fixed content storage"?
Back: CAS is normally used for files that are not frequently edited.
Reference: “Content-Addressable Storage,” in _Wikipedia_, February 27, 2024, [https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681](https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681).
<!--ID: 1709177255567-->
END%%
%%ANKI
Basic
How is it CAS systems ensure file uniqueness?
Back: An attempt to store an already stored file will generate the same key as before.
Reference: “Content-Addressable Storage,” in _Wikipedia_, February 27, 2024, [https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681](https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681).
<!--ID: 1709177255570-->
END%%
%%ANKI
Basic
How is it CAS systems ensure file's remain unchanged?
Back: A file's key will always be the same provided the content has not changed.
Reference: “Content-Addressable Storage,” in _Wikipedia_, February 27, 2024, [https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681](https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681).
<!--ID: 1709177255573-->
END%%
## References
* “Content-Addressable Storage,” in _Wikipedia_, February 27, 2024, [https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681](https://en.wikipedia.org/w/index.php?title=Content-addressable_storage&oldid=1210669681).
* Scott Chacon, _Pro Git_, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).

View File

@ -0,0 +1,3 @@
---
title: Filesystems
---

3
notes/git/index.md Normal file
View File

@ -0,0 +1,3 @@
---
title: Git
---

174
notes/git/objects.md Normal file
View File

@ -0,0 +1,174 @@
---
title: Objects
TARGET DECK: Obsidian::STEM
FILE TAGS: fs::cas git
tags:
- cas
- fs
- git
---
## Overview
%%ANKI
Basic
What cryptographic hash function does git use internally?
Back: SHA-1
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255577-->
END%%
%%ANKI
Basic
How many bytes make up a SHA-1 digest?
Back: 20
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255580-->
END%%
%%ANKI
Basic
How many hexadecimal digits make up a SHA-1 digest?
Back: 40
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255584-->
END%%
%%ANKI
Basic
How is a SHA-1 digest typically represented?
Back: As a string of 40 hexadecimal digits.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255589-->
END%%
%%ANKI
Basic
What is "oid" an acronym for?
Back: **O**bject **id**.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255594-->
END%%
%%ANKI
Basic
What *is* an object id?
Back: The digest produced when hashing/storing content.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255599-->
END%%
%%ANKI
Basic
What does it mean for git to be a content-addressed storage system?
Back: Keys generated from hashing content are used to later retrieve said content.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
Tags: fs::cas
<!--ID: 1709177255603-->
END%%
%%ANKI
Cloze
Interpreted as a key-value store, {oids} are to keys as {objects} are to values.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
Tags: fs::cas
<!--ID: 1709177255607-->
END%%
%%ANKI
Basic
Why prefer term "oid" over e.g. "SHA-1 digest" or similar?
Back: Git is transitioning to the use of other cryptographic hash functions.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255612-->
END%%
%%ANKI
Basic
What is a "porcelain" command?
Back: A user-friendly command.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255618-->
END%%
%%ANKI
Basic
What is a "plumbing" command?
Back: A lower-level command.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255622-->
END%%
%%ANKI
Cloze
{Porcelain} commands are more user-friendly than {plumbing} commands.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255627-->
END%%
%%ANKI
Basic
What plumbing subcommand is used to generate an oid?
Back: `hash-object`
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255632-->
END%%
%%ANKI
Basic
The `hash-object` subcommand optionally stores the resulting object in what directory?
Back: `.git/objects`
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255637-->
END%%
%%ANKI
Cloze
The {object database} refers to the {`.git/objects`} directory.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255644-->
END%%
%%ANKI
Basic
What does the `hash-object` subcommand return?
Back: The computed object id.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255651-->
END%%
%%ANKI
Basic
What optional functionality does the `hash-object` subcommand support?
Back: It can write an object into the object database.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255659-->
END%%
%%ANKI
Basic
What flag lets the `hash-object` subcommand write to the object database?
Back: `-w`
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255664-->
END%%
%%ANKI
Basic
Where does object e.g. `d670460b4b4aece5915caf5c68d12f560a9fe3e4` live in the object database?
Back: At `.git/objects/d6/70460b4b4aece5915caf5c68d12f560a9fe3e4`.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255668-->
END%%
%%ANKI
Basic
What regular files exist in the object database after `git init`?
Back: None.
Reference: Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).
<!--ID: 1709177255672-->
END%%
## References
* Scott Chacon, *Pro Git*, Second edition, The Experts Voice in Software Development (New York, NY: Apress, 2014).

View File

@ -863,7 +863,7 @@ END%%
%%ANKI
Basic
How do define $s'$ such that $s(E_e^x) = s'(E)$?
How do you define $s'$ such that $s(E_e^x) = s'(E)$?
Back: $s' = (s; x{:}s(e))$.
Reference: Gries, David. *The Science of Programming*. Texts and Monographs in Computer Science. New York: Springer-Verlag, 1981.
<!--ID: 1707939006292-->