Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data collection API #6

Open
briancavalier opened this issue Aug 1, 2013 · 0 comments
Open

data collection API #6

briancavalier opened this issue Aug 1, 2013 · 0 comments

Comments

@briancavalier
Copy link
Member

Ideally, we want to keep cola.next as data-format-agnostic as possible, and currently it does a pretty good job, since we rely on a datasource's metadata descriptor to help us interact with the data. One place we haven't covered yet is an observer that needs to consume a collection of data from any datasource ... for example, a bard view.

For example, datasource.fetch() may return anything it wants ... an Array, a backbone Collection, a promise for any of the above, etc. So, an observer who wants to be able consume data from any datasource can't know what it will receive.

Here are a couple ideas:

  1. Specify a minimal API that any collection must implement
  2. Add an API to the metadata descriptor

In either case, the API could be something super-simple like either a forEach() method, or an iterator() method which returns an ES6-like { next: function() } iterator. Both of those allow streaming and asynchrony, so they seem flexible enough. Streaming is trickier with iterators since they are pull-based, but they do facilitate lazy evaluation a bit more easily, which could be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant