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 new dependency system. #52

Open
mason-bially opened this issue Jun 10, 2014 · 1 comment
Open

Create new dependency system. #52

mason-bially opened this issue Jun 10, 2014 · 1 comment

Comments

@mason-bially
Copy link
Member

Create the new dependency system for watching files and specifying file relationships with each other.

Primarily via the ECS.

@mason-bially
Copy link
Member Author

Implementation of this may require #51.

There are a couple of high level issues here:

  • Detecting that data (like files, or objects) are out of date, in either a poll or event oriented way.
  • Knowing which objects depend on which other objects.
  • Updating or replacing out of date objects using new updated objects, and do so in an efficient manner.

The feature provided by the new dependency system will be manipulating the graph of objects which depend on each other, and driving the resolution of dependencies. This system will be responsible for managing polling and triggered events of out of date objects. Caching (and optimally updating) dependencies, and updating objects in the graph in the optimal order will be the responsibilities of this system as well.

Eventually the planner will be responsible for creating the objects in the dependency graph, and some objects in the graph may invoke the planner to rebuild the dependency graph.

DependencyEngine

The dependency engine will have the following interface:

  • as_node(self, object): Generate a graph node for a DependencyObject. This node can then be used for traversals. The nodes represent the traversal of all things the current node depends on.
  • last_objects_used_for(self, object): Generate a dictionary of the objects, and their versions used for the last version of the object given.
  • regenerate(self, object, versions={}): Generate a new version of the object given (and return it). Force overriding of some dependencies can be done with the versions argument.
  • add_coercing(self, icoerce): Adds a coercing interface for objects, primarily entities.

DependencyObject

An abstract base class providing the following features:

  • depend_id(self): Provides an id for this object, should not change between recreation of the object. For example entity ids, file paths, or tuples of constructor arguments.
  • depend_version(self): DependecyVersion object for the given id.
  • depend_expands_on(self): Returns a dictionary of DependencyObjects, with object specific mappings as keys, which this object uses to generate the depends_on function.
  • depends_on(self, expands_on): Returns a dictionary of DependencyObjects, with object specific mappings as keys, using expands_on to expand from (to prevent 2 calls to depend_refresh).
  • depend_refresh(self, changed, all): Asks the object to refresh itself with the given objects, using the object specific mappings in depends_on. Returns a the new object (often self). Can trigger events which may cause the replacement of this object in some contexts.

Misc.

Will require the addition of a Node interface and utility library. As well as a helper descriptor for wrapping objects which replace themselves.

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