smart_arrays_dbstore 2.1.0 smart_arrays_dbstore: ^2.1.0 copied to clipboard
Storing 1D or 2D arrays with their metadata inside indexedDB databases on the local device (for WEB applications).
Smart Arrays Database Store #
What the package can do for you #
-
This package was designed for Web applications which need to store data on the local device (PC, tablet, phone) over a longer time period, e.g. to view or process the data by a Web app during multiple sessions.
-
The package is capable of saving one- and two-dimensional arrays of double values and String-valued maps in databases, optionally along with metadata containing additional information about the actual array data.
-
Arrays with their metadata are considered as "datasets" of type
DSet
. ADSet
can be created from arrays and metadata using this package. -
Each dataset
DSet
is stored in its own database of typeIndexedDB
under the browser. The user must define its name (similar as one would do it under a file system) for later retrieval. -
Many datasets, even of big size (e.g. array sizes of several megabytes) may be stored. The exact limits per origin are browser dependent. Browsers derive their limits from the available storage using their own algorithms.
-
The package was tested using the following browsers: Chrome under Windows, Linux, Android, iOS. Safari under iOS.
-
Datset sets will remain stored until
- they are explicitely deleted by using respective API functions provided by this package.
- the user deleted the browser data via respective functions of the operating system or from the browser's advanced settings menu.
- the browser itself decided to delete data. This may happen if storage on the local machine is running tight ("storage pressure"). However: Some browsers (e.g. Chrome) support "persistent" data. This package provides a function 'DSetDB.persistent' requesting data to make the storage persistent ("durable") if supported. You must check with your browser whether and under which conditions persistence is granted. For Chrome you may e.g. check the site
https://developers.google.com/web/fundamentals/instant-and-offline/web-storage/offline-for-pwa
.
-
This packages utilizes
IndexedDB
databases managed by the browser. Their technical storage method and storage location on a device is browser dependent, and also depends on the origin from which the Web app is served. For Chrome, you can list the databases by enteringchrome://indexeddb-internals
into the browser's address field.
The major API functionalities #
-
Class
DSet
to create a datset from arrays and its metadata: -
Class
DSkey
to create a datset key (dataset identifier) under which a dataset will be stored. -
Class
DSetStore
, a handler to store datasets on the device, to load stored datasets, to delete, copy, rename datasets, to obtain a list (directory) of stored datasets, to save information common to all datasets in a global store, to classify datasets intoprojects
. -
Class
DSetDB
to initially create aDSetStore
required to apply the functionalities above. -
Basic usage to store a datset:
- create a dataset of type
DSet
from your array and metadata (constructorDSet
). - create a
DSkey
identifier for your data in the store (methodDSKey.create
) - create a
DSetStore
storage handler (methodDSetDB.createDSetStore
). - invoke
DSetStore.dsSave
to store the data
- create a dataset of type
-
Basic usage to load a stored datset:
- create a
DSkey
identifier for the data you want to load from the store (methodDSKey.create
) - create a
DSetStore
storage handler (methodDSetDB.createDSetStore
). - invoke
DSetStore.dsLoad
to load stored data
- create a
-
Basic usage to find out which datasets are available in the store:
- create a
DSetStore
storage handler (methodDSetDB.createDSetStore
). - invoke
DSetStore.projectsGet
to get a list of all projects. - For each project, invoke
DSetStore.dskeysWithProject
to get a list of the dataset keys of the dataset stored under this project. You will use then such a key to load the data. Or you can build a GUI displaying the projects with their datasets.
- create a
Please check the provided example for details.
Related packages #
smart_arrays_base
: Basic functions for 1D and 2D arrays
smart_arrays_numerics
: Numerics with 1D and 2D arrays
smart_arrays_compress
: Compress 1D and 2D arrays to a smaller size.
smart_arrays_sample_data
: Computes 1D and 2D arrays containing sample data.
smart_arrays_dbstore
: Store 1D and 2D arrays along with metadata on the local device.
smart_arrays_peaks
: Detect peaks in 1D and 2D arrays.
smart_arrays_plot_polyline
: Plot 1D arrays as polyline along with axes and more.
smart_lorentz_gauss
: Compute Lorentz-Gauss (pseudo-Voigt) line shapes.
smart_signal_processing
: Fourier transform and more of arrays.