Commit graph

6 commits

Author SHA1 Message Date
Ernest Wong c2dcb440dd Filestorage: Refactor fallback and load-from-server
Fallback logic is moved to the caller's responsibility.

Empty FileStorages and FileStorages that load from the server are
separated into different classes. This is to avoid faults where the
caller of the constructor forgets to pass in a `baseurl` parameter and
leads to some confusing bug.
2020-08-30 19:37:15 -05:00
Ernest Wong 6a06a7108a Tidy: file_storage snake case and interface naming convention 2020-08-30 19:37:15 -05:00
Ernest Wong 6fe226eec9 Filestorage: Reuse write-to-indexeddb logic 2020-08-30 19:29:54 -05:00
Ernest Wong 27a825dce3 Filestorage: Preserve key names when writing into indexeddb 2020-08-30 19:29:54 -05:00
Ernest Wong a0c984dc8d Filesystem: Introduce IndexedDBFileStorage
Uses MemoryFileStorage as a fallback when:
- v86 is used in a browserless environment, e.g. NodeJS
- browser doesn't support indexedDB
- opening indexedDB fails
- existing database is a newer version
- existing database is an old version and is under use - blocking
current v86 instance to connect to it.
2020-08-30 19:29:54 -05:00
Ernest Wong 0a67e3532f Filesystem: Introduce FileStorage class for server-loaded files 2020-08-30 19:29:54 -05:00