operator-framework / deppy

Deppy: The dependency resolver for Kubernetes
Apache License 2.0
15 stars 21 forks source link

EntitySource API #43

Closed perdasilva closed 8 months ago

perdasilva commented 1 year ago

User Story

As a user I would like to create to provide content to my solver from different sources (e.g. service, file, hard-coded, etc.)

Summary / Background

Deppy is a framework for creating constraint solvers over "entities". It is composed of the following components:

  1. Entity: a structure with an unique string id and a set of properties (map[string]string)
  2. EntitySource: an interface to a source of entities. It implements an entity query interface that allows consumers to find entities that contain certain properties, sort the result rest on an arbitrary basis, and also group entities by an arbitrary key function (e.g. GroupBy(func(entity *Entity) string) map[string][]Entity))
  3. ConstraintGenerator: an interface that can produce []solver.Variable given an entity query interface (something that can query over a set of EntitySources`)

Acceptance Criteria

Scenarios

Assumptions

Links (docs, drawings, designs, etc)

Deppy-as-a-Framework

Dependencies

Definition of Done

akihikokuroda commented 1 year ago

I looked at the example. I wonder if we can separate the interface used by the solverAPI and interface provided by the entity source (deppysource)? The Get, Filter, Groupby and sort are not source type dependent once the entities from the deppy source are cached. So these functions can be provided in the interface used by the solverAPI without the entitysource interface implementing it. So the entity source just need to provide the sync function. WDYT @perdasilva

akihikokuroda commented 1 year ago

I put the entitysource interface in the source package and also made a use of the EntityUniverse. But it causes import cycle not allowed error. So I had to make the entitysource pakage out of the source pakcage. If the EntityUniverse is in the source package, I can put the entitysource into the source package, too. @perdasilva WDYT

github-actions[bot] commented 1 year ago

This issue has become stale because it has been open 60 days with no activity. The maintainers of this repo will remove this label during issue triage or it will be removed automatically after an update. Adding the lifecycle/frozen label will cause this issue to ignore lifecycle events.

m1kola commented 8 months ago

Obsolete, closing