Skip to content

Engine initialization

Anton Vorobyov edited this page Mar 15, 2015 · 9 revisions

You need two things to initialize the data source for use in calculation engine:

  1. data handler
  2. cache handler

and optional flag which controls if this instance of engine will be marked as default or not.

data_handler = JsonDataHandler('data_folder/phobos/')
cache_handler = JsonCacheHandler('data_folder/cache/eos.json.bz2')
SourceManager.add('some_alias', data_handler, cache_handler, make_default=True)

Data handler

It will provide access to the data Eos needs. Built-in data handlers:

Of course, you can write your own handler as needed. Interface is defined in abstract base class.

Eos data handler needs access to following data in format of [{field name: field value}, ...] for each table:

  • invtypes
    • typeID
    • groupID
    • radius
    • mass
    • volume
    • capacity
  • invgroups
    • groupID
    • groupName
    • categoryID
  • dgmattribs
    • attributeID
    • maxAttributeID
    • defaultValue
    • highIsGood
    • stackable
  • dgmtypeattribs
    • typeID
    • attributeID
    • value
  • dgmeffects
    • effectID
    • effectCategory
    • isOffensive
    • isAssistance
    • durationAttributeID
    • dischargeAttributeID
    • rangeAttributeID
    • falloffAttributeID
    • trackingSpeedAttributeID
    • fittingUsageChanceAttributeID
    • preExpression
    • postExpression
    • modifierInfo
  • dgmtypeeffects
    • typeID
    • effectID
    • isDefault
  • dgmexpressions
    • expressionID
    • operandID
    • arg1
    • arg2
    • expressionValue
    • expressionTypeID
    • expressionGroupID
    • expressionAttributeID
  • phbmetadata
    • field_name
    • field_value

Cache handler

Its purpose is to provide fast and efficient way to the data Eos needs for calculations. It should take data in the following format ({entity name: set({field name: field value}, ...)}:

  • types
    • type_id (integer)
    • group (integer)
    • category (integer)
    • attributes ({integer: float, ...})
    • effects ([integer, ...])
    • default_effect (integer)
  • attributes
    • attribute_id (integer)
    • max_attribute (integer)
    • default_value (float)
    • high_is_good (boolean)
    • stackable (boolean)
  • effects
    • effect_id (integer)
    • effect_category (integer)
    • is_offensive (boolean)
    • is_assistance (boolean)
    • duration_attribute (integer)
    • discharge_attribute (integer)
    • range_attribute (integer)
    • falloff_attribute (integer)
    • tracking_speed_attribute (integer)
    • fitting_usage_chance_attribute (integer)
    • build_status (integer)
    • modifiers ([integer, ...])
  • modifiers
    • modifier_id (integer)
    • state (integer)
    • scope (integer)
    • src_attr (integer)
    • operator (integer)
    • tgt_attr (integer)
    • domain (integer)
    • filter_type (integer)
    • filter_value (integer)

When requested, it should return various objects needed for Eos when it uses handler's corresponding methods.

Built-in cache handlers:

Interface is defined in [BaseCacheHandler] (https://github.com/DarkFenX/Eos/blob/master/data/cache_handler/abc.py).

Default instance flag

If true, all fits created within current python interpreter will use this source assigned; otherwise, you will have to pass valid Source instance or its alias each time you instantiate a fit.

Clone this wiki locally