Data and Network Sources
A Source is an object that conforms to the Source interface. It allows you to save data to it, retrieve data, and watch for changes. It is usually backed by some sort of database: Postgres, the file system, or storage on the browser and React Native.
A network source is another data source, proxied over a network interface. It has the same DataSource interface, and it also will correctly pass-through the behavior of a Protected Source interface.
Source Interface
The detailed interface is specified here, but a source essentially provides three interfaces:
async dispatch(action): Result - a way to asyncronously dispatch actions for fetching data, uploading, and requesting mutations.
observeDoc(domain, name): BehaviorSubject - allows you to subscribe to document changes
observeDocChildren(domain, name): Subject - allows you to subscribe to new or deleted Docs, under a certain doc or domain
Included Source Modules
Aven Cloud ships with the following data sources, but you can also build your own.
MemoryDataSource- for testing and ephemeral storage
FSDataSource- file-system storage for a single node.js process
PostgresDataSource- for several node.js processes in front of PostgreSQL
ReactNativeDataSource - coming soon
BrowserDataSource - coming soon
We also provide the following network sources:
BrowserNetworkSource- for connecting Browser apps to remote sources
NativeNetworkSource- for connecting React Native apps to remote sources
NodeNetworkSource- for connecting node.js apps to remote sources