New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

path-store

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

path-store

Store JavaScript objects at a path, with fallbacks to multiple backends

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

Path-Store

A Key Value store with support for multiple backends

Path-Store is still in early development.

What is it

Path-Store is a key value store that makes use of paths in order to pull data from multiple backends. For instance, to query a Firebase instance you might use the path /root/firebase/path/to/value. Backends can easily be implemented using a simple API.

The idea is be able to cache your data across a series of different Backends. For instance, you might have an in-memory Backend that syncs to an IndexDB Backend. The in-memory Backend can act as a cache over the IndexDB Backend. Furthermore, the IndexDB Backend could sync to a remote Postgres instance, with the IndexDB Backend acting as a cache over the remote database. In this way, very large datasets can be easily manipulated without downloading the entire set, and a variety of databases can be coordinated.

A Simple Backend Example:

In theory, Path-Store can be used as a simple wrapper around a set of functions that communicated with a remote database (a Backend). Nothing is cached, and each query to Path-Store is really just a query to the database.

A Better Backend Example:

A better use case would combine a remote database Backend with an in-memory Backend. The in-memory Backend would cache all calls to the remote database, and the size of the cache can be easily controlled.

How does it work

Path-Store maintains an internal graph representation of your data. Each Node on the graph contains a value and map of paths to other nodes. When queried, Path-Store uses a given path to find the appropriate Node.

The Paths

A path can be represeted as an array of strings. The path /root/firebase/path/to/value would, for instance, be represented like so: ["root", "firebase", "path", "to", "value"].

This looks like a sort ofmap of maps. Each item in the path array is a key to a map on a Node. Each item in the path array is a key to the map in which to find the next Node. In our example, the root Node must have the key "firebase" in its map, and it's value must be a different Node with a map containing the key "path", and so on. The value returned from querying with this path with the the final Node's value property.

Backend

A Path-Store Backend is an easily implemented API plus a cache.

FAQs

Package last updated on 04 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts