Schema reference v0.1

  • version [string] – top level block, defines schema version. Required
  • import [string|list] – single url to file or list of strings to import. Each imported file should have full, valid schema with top-level block
  • application – dictionary with definitions of all models, listeners, scripts and variables
    • variables – section with definition of global variables, accessible in any place of application and data definitions
      • variable name – dictionary with definition of single variable
        • value [string] – static content
        • from_object – if used instead value, then starsheep will use object to calculate variable contents dynamically, each time variable is accessed
          • model [string] – object ID or "@ModelName" for first owned object of given model name
          • field|list|dict [string] – name of field, name of list with index in form: list_name,index or name of model’s dict name with key in form: dict_name,key
          • read_as [string] – object ID or „@ModelName”. If specified, then decrypted value of field, list or dict will be read with this object’s keys
        • from_script – if used instead value, then starsheep will capture script’s output and set it as variable contents, each time when variable is accessed
          • script_name [string] – name of script
        • from_cmdline [string] – if used instead value, then starsheep will pass variable given as string name as value of this variable
    • scripts – section with definition of scripts
      • script_name – dictionary with definition of single script
        • interpreter [string] – path to interpreter binary (without any parameters)
        • script [script] – script contents, which will be passed as interpreter’s parameter
        • timeout [integer] – timeout to execute script
        • variables – dicrionary of variables, with syntax same as global variables
    • listeners – section with definition of listeners. Each listener could be executed on configured data change in dinemic database, especially on object creating, update or removal
      • listener_name – dictionary with single listener
        • trigger [string] – selects which models, objects or fields on database should trigger execution of this listener. Check Dinemic reference for details
        • call_on [string] – defines on which actions related to trigger, the listener should be executed. Owned triggers are related to both, authorized and unauthorized changes. Possible values are:
          • create
          • created
          • owned_created
          • update
          • owned_update
          • authorized_update
          • unauthorized_update
          • updated
          • owned_updated
          • authorized_updated
          • unauthorized_updated
          • deleted
          • owned_deleted
          • authorized_deleted
          • unauthoruzed_deleted
          • remove
          • owned_remove
          • authorized_remove
          • unauthorized_remove
        • action [string] – what kind of action should be taken when listener is triggered
          • reject – prevent executing next listeners and applying changes on database (does not take effect on post-action listeners, like updated)
          • script – execute script when listener is triggered. Script gets information about changed object and related objects as env variables
        • reason [string] – if action is reject this gives reason of rejection to logs
        • script_name [string] – if action is script, this stores script name to be executed
        • read_as [string] – used with script listener. Read information about updated object as owned object (if starts with „@”) or as given object ID
        • related_objects [list of strings] – add variables with information about all listed objects. Encrypted fields will be decrypted with read_as object.
        • update – dictionary. This feature will be implemented in next schema version to update database directly from listener
    • models – section with definition of data models
      • model_name – name of single mdoel
        • instances [string] – optional. Defines how many instances of model should be created on local machine when applying the data. Each object will be visible on all other nodes. Possible values:
          • 0 – don’t create any object. This could be done manually, from command line
          • 1 – create exactly one instance of this model on local machine (and this machine will own its secret, cryptographic keys). If there is existing instance, then its contents will be updated. If there is more than one instance, then exceeding ones will be removed
          • + – allow multiple instances
        • unique [string] – name of field in model, that will be used to check if model exists. If there is existing object of this model with given value , then other fields will be updated. Otherwise new object will be created. Should not be used together with instances.
        • fields – dictionary with field names for models
          • field_name – dictionary with single field definition
            • can_update [string] – defnes if only authorized could update or all. If authorized is set, then additional reject listener is added automatically to dinemic
            • can_read – defines if all could read contents of this field, or authorized only. If authorized is set, then data in this field will be encrypted.
            • listeners [list of strings] – list of listener names, that should be executed when there is change related to this field
        • lists – dictionary with names of lists
          • list_name – dictionary with single list definition. The schema is same as in fields
        • dicts – dictionary with names of lists
          • dict_name – dictionary with single list definition. The schema is same as in fields
        • listeners [string list] – list of listener names that should be applied on whole model changes with Model:[ID] and Model:[ID]:* filters.
  • data – dictionary with object definitions. Each entry could create new object, list of object or update existing one(s)
    • model_name – single entry related to model with single model or list of models
      • authorized_objects – list of authorized_objects. Values could be strings or could be obtained as variables
      • upadte_as – perform any changes in objects as certain ID. If string starts with @ModelName then first matching owned object is used
      • fields – dictionary with field values of object
        • field_name
          • value – fixed value of field
          • from_variable – calculate value of field from variable defined in application:variables section
      • lists
        • list_name
          • list_entry – single list entry with schema same as in field definition
      • dicts
        • dict_name
          • key – single dict key with schema same as in field definition