WEBVTT

00:00:00.500 --> 00:00:03.260
The library has many members and many branches.

00:00:04.160 --> 00:00:06.074
Members are rows in one table.

00:00:06.973 --> 00:00:08.197
Branches are different.

00:00:09.095 --> 00:00:12.637
Each branch is a module of its own, with its own sealed shelf.

00:00:13.535 --> 00:00:14.655
Why the difference?

00:00:15.554 --> 00:00:18.145
Branches owns a keyed set of child modules.

00:00:19.043 --> 00:00:22.090
One key per branch, one Shelf module per key.

00:00:22.989 --> 00:00:26.895
It is declared in the version file, beside the data, as children.

00:00:27.793 --> 00:00:30.436
And it names the exact version of Shelf it holds.

00:00:31.335 --> 00:00:32.259
Remember that.

00:00:33.158 --> 00:00:35.020
It matters when Shelf changes.

00:00:35.918 --> 00:00:37.220
Here is the difference.

00:00:38.119 --> 00:00:40.397
Members can read every one of its rows.

00:00:41.296 --> 00:00:43.653
Branches cannot read inside a shelf.

00:00:44.551 --> 00:00:48.574
It can only attach one, remove one, and call its public functions.

00:00:49.473 --> 00:00:51.765
A branch is opened and closed as a whole.

00:00:52.663 --> 00:00:54.278
It holds a table of its own.

00:00:55.176 --> 00:00:56.947
That is what earns it a module.

00:00:59.067 --> 00:01:01.033
An admin opens branch five.

00:01:01.933 --> 00:01:05.852
Branches creates a new, empty Shelf and attaches it on key five,

00:01:06.074 --> 00:01:07.037
in the same call.

00:01:07.936 --> 00:01:09.407
Then a tool is added to it.

00:01:10.306 --> 00:01:12.454
Later, branch five closes.

00:01:13.352 --> 00:01:16.894
Branches asks the shelf one question: is every tool home?

00:01:17.793 --> 00:01:18.392
It is.

00:01:19.290 --> 00:01:21.204
Branches removes the attachment.

00:01:22.102 --> 00:01:25.214
The shelf and everything inside it are gone when the call ends.

00:01:26.113 --> 00:01:27.727
Open branch five again.

00:01:28.626 --> 00:01:29.850
The key is the same.

00:01:30.748 --> 00:01:31.998
The module is new.

00:01:32.897 --> 00:01:33.912
It starts empty.

00:01:34.811 --> 00:01:36.764
Nothing of the old shelf comes back.

00:01:37.662 --> 00:01:39.954
Now someone tries to close branch three.

00:01:40.852 --> 00:01:43.717
Its shelf answers: no, tools are out.

00:01:44.615 --> 00:01:46.959
Branches refuses and changes nothing.

00:01:47.858 --> 00:01:51.126
Removing a module removes its memory, so the rule that guards

00:01:51.139 --> 00:01:52.480
it belongs in the design.

00:01:54.600 --> 00:01:56.045
One more consequence.

00:01:56.945 --> 00:01:59.784
The loan book remembers which branch a tool came from.

00:02:00.682 --> 00:02:02.219
It stores the branch number.

00:02:03.117 --> 00:02:06.203
It cannot store the shelf itself, or a handle to it.

00:02:07.102 --> 00:02:10.109
To reach a shelf, code asks Branches by number.

00:02:11.008 --> 00:02:14.523
And because every key is a whole module, the app sets a limit.

00:02:15.422 --> 00:02:17.323
Here, thirty-two branches.

