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

Move object mapping to mainService DataService #1968

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

tejaede
Copy link
Collaborator

@tejaede tejaede commented Apr 16, 2018

No description provided.

@tejaede
Copy link
Collaborator Author

tejaede commented Apr 21, 2018

Latest commits add a couple of new features to the API.

  1. DataService#batchAddsDataToStream is a boolean that allows defining whether the service adds mapped objects to the DataStream as soon as each is ready or waits for the entire batch of rawData to finish mapping before adding it to the DataStream.

  2. PropertyDescriptor#isDerived allows defining whether a DataTrigger should return an in-process update on updateObjectProperty, if it exists.

*Note: PropertyDescriptor#isDerived existed but was unused as far as I could tell. I felt it accurately describes the new functionality and so I used it to avoid changes to the API surface.

For example, assume updateObjectProperties(myObject, "aProperty") below take a few seconds to resolve. This means that Update 2 will occur before Update 1 has resolved. Further explanation is in the comments

//Update 1
this.service.updateObjectProperties(myObject, "aProperty").then(function () {});

//Update 2
this.service.updateObjectProperties(myObject, "aProperty").then(function () {
     // If the propertyDescriptor of "aProperty" has isDerived = false (default), this update
     // will receive the same promise generated by Update 1.

     // If the propertyDescriptor of "aProperty" has isDerived = true, this update will kick off
     // a new fetch and generate a new promise. 
});

This name "isDerived" comes from the idea that a derived property's value is subject to change based on the criteria used to fetch it. By that logic, we cannot assume that two updateObjectProperties() for the same property return the same results, and therefore, we cannot return the same promise for 2 separate calls. In the future, we can improve on this by checking whether there were changes on the properties on which this property is derived.

@johnnykahalawai @marchant

@tejaede tejaede force-pushed the tej/features/data-service-mapping branch from 713d596 to c5681e9 Compare May 9, 2018 03:13
@hthetiot hthetiot added this to the v17.3.x Data milestone May 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants