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 do 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 as follows:
As annotated above, at first, we are getting into the /usercode
directory and creating an exampleFile.txt
using the touch
command in the terminal. That will create a file 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 within the environment will not persist. Let’s understand this by the following example.
As annotated above, ① we are getting into the /usercode
directory and ② trying to edit exampleFile.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 saved the file after writing some stuff as shown above and it can be verified as follows:
As annotated above, it can be seen that the stuff we wrote using nano is there.
While all the above-given screenshots depict that once we create something in the
/usercode
directory, it would be there until we explicitly remove it.
If we reload the page and press the Launch Workspace button, we’ll not find the nano command there. To check this, we only have to issue the nano command when the terminal become visible after relaunching the Workspace as shown below:
The above-given screenshot is verifying that the interactions (changes) with the files in the
/usercode
are there. While the environment variables and installations like nano are reverted to the default.