Skip to content
David Souther edited this page Dec 24, 2012 · 1 revision

Runtime methods are provided as-is by a particular runtime implementation.

Constructor

Runtime(URI, options) -> Runtime

Creates a new runtime whose primary context will be loaded from the URI given

  • URI The URI for the context description.
  • options An object containing override parameters. Specific options should be detailed by the individual runtime implementations.

returns A reference to the newly-instantiated runtime.

Methods

definition(type) -> entity_definition

Returns the context's definition for the specified type.

  • type String type of an object; either the short name within the primary context, the medium name within an extended context, or a complete name with a full context type URI.

returns An object with the entity's type definition.


build(type, obj) -> Entity

Return an non-interned instance of type with properties filled in from obj.

  • type String type to apply prototypes to.
  • obj Object with default values for the entity.

returns A reference to the newly-created entity.


intern(Entity, updateOnIntern=false) -> Runtime

Returns a canonical instance of the entity from memory. Use this to translate between UUIDs and pointers (or similar machine references). If the boolean updateOnIntern is true, and there is a previously stored entity, the old entity will be updated with any non-default properties of the new entity. Otherwise, the old entity will be replaced.

  • entity Entity to intern.
  • updateOnIntern Boolean (default false) to specify default behavior.

returns A reference to the runtime.


expand(Transaction) -> Runtime

Expand the results of a transaction into the runtime. Intern where possible, and call add_'name' and set_'name'where appropriate.

  • Tranasaction Transaction to expand and intern each entity therein.

returns A reference to the runtime.


save_new(Store) -> Promise

Start a transaction to persist all new entities to the given PersistenceStore.

  • Store Which store to save the new data to.

returns A Promise that will resolve when the execute has completed.


save_all(Store) -> Promise

Start a transaction to persist all modified entities to the given PersistenceStore

  • Store Which store to save the new data to.

returns A Promise that will resolve when the execute has completed.

Events

saving this Triggered when an EntityContext begins to save data.

  • this A reference to the entity itself.

saved this Triggered when an EntityContext has finished persisting data to a remote runtime.

  • this A reference to the entity itself.
Clone this wiki locally