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

Create final interface to listen to entities #9

Open
absolutedogy opened this issue Sep 9, 2024 · 0 comments
Open

Create final interface to listen to entities #9

absolutedogy opened this issue Sep 9, 2024 · 0 comments

Comments

@absolutedogy
Copy link
Contributor

Right now there is simply an event being emitted when a new entity update is ready.
Part of the issue here is that it is triggering on everything, which is less than ideal as we want to simply throw away the results of certain entities but still need to consume through the stream to make sure we are aligned when we hit entities we want.

The first step for this is making an interface that lets the consumer describe ahead of parsing what entities they actually care about to create a list of discarded entities to be ignored and optimized away.

I believe for this interface we can describe it in this way

public void OnEntityCreate<TEntity>(Action<TEntity> callback): where TEntity is BaseEntity 
public void OnEntityUpdate<TEntity>(Action<TEntity> callback): where TEntity is BaseEntity 
public void OnEntityDelete<TEntity>(Action<TEntity> callback): where TEntity is BaseEntity 

Each of these actions will take in a callback function that will be invoked when the given entity event happens. When this subscription is added we will have an internal tracking at some point that can identify what types have been requested and ignore types that are not requested.

Code generation will be used to create the map of available types which will allow very nice strongly typed interfacing here that gives access to the entity events.

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

No branches or pull requests

1 participant