Persistence: Perks and Limits
Learn about the persistent storage capabilities offered by Workspace.
We'll cover the following
Introduction
Since we have a brief overview of the workspace widget in our previous lesson, let’s see what we mean by the persistence of the workspace widget, and for that, let’s get into the preview mode of the workspace by clicking the “PREVIEW” button (mentioned in the previous lesson).
Persistence storage
Once we are in the preview mode of the Workspace, let’s see how the files and the interactions with the existing files are being captured and retained by Workspace:
Now we add some text in the empty text file.
As annotated above, at first, we are creating an example.txt
file using the touch
command in the terminal. This file will start showing up in the leftmost file tree, and by clicking on it, we can make changes, and these changes will be reflected accordingly, verified using the cat
command in the above-given example.
Such changes and interactions related to the
/usercode
directory will be retained even after the page refresh, reload, or relaunch of the Workspace.
State change
As we mentioned earlier, the interactions/changes made to the /usercode
directory are retained. While the changes or installations done outside of this environment will not persist. Let’s understand this by the following example.
As annotated above, ① trying to edit example.txt
using nano
, but it’s saying: nano: command not found
. Therefore ② we installed the nano using apt-get install nano -q -y
, and after that, when we hit enter, the following screen will appear.
We save the file after writing some text as shown above:
As discussed earlier, the changes we made using nano
will persist.
These screenshots depict that once we create something in the
/usercode
directory, it will be there until we explicitly remove it.
If we now reload the page, we’ll find that the nano
editor is no longer available. To check this, we only have to issue the nano
command when the terminal becomes visible after relaunching the workspace as shown below:
This confirms that though the changes to the files in the
/usercode
persist between sessions, the changes made to the overall OS do not persist. Note that any settings for environment variables etc fall in this latter category.