foam-framework / foam

Feature-Oriented Active Modeller
Apache License 2.0
787 stars 55 forks source link

Correctly propagate the "eof" signal through DAOs and Sinks (Swift). #559

Closed nbegley closed 8 years ago

adamvy-google commented 8 years ago

EOF is not really intended to be fired as an event from a DAO. IT's a single to a specific sink telling that sink that the event has finished.

What is your use case?

nbegley commented 8 years ago

I'm listening on a DAO, and I'd like to react to the changes caused by a select() once all of the changes have settled, instead of reacting to each put/remove individually.

adamvy-google commented 8 years ago

A select() shouldn't cause changes, select is a read operation.

You .listen() on a DAO if you want to react to write operations against the DAO (.put(), .remove() and .removeAll()). If your listener is firing too often then you can delay responding to the event by using isMerged on your Listener. But there's no way for a listener to know when mutations to the DAO are "done" since any client of the DAO can issue a mutation operation at any time.

nbegley commented 8 years ago

Thanks Adam, I agree that isMerged sounds like the right way to go.