new PatchGenerator(db [, transactionId])
Creates a PatchGenerator
.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
db |
olympe.dc.DBView | ||
transactionId |
string |
<optional> |
ID used for the creation of patches and rollback patches |
Methods
-
createInstance(tag, persist [, properties])
-
Creates an instance and returns it's tag
Parameters:
Name Type Argument Description tag
string New instance tag
persist
boolean Should persist this instance or not
properties
Map.<string, ?*> <optional>
Instance's properties (map of properties names to values)
-
createRelation(relation, originTag, destinationTag)
-
Creates a relation between two instances on the specified destination
Parameters:
Name Type Description relation
string Type of the relation
originTag
string Origin instance tag
destinationTag
string Destination instance tag
-
deleteInstance(tag, followRule)
-
Deletes an instance
Parameters:
Name Type Description tag
string followRule
olympe.dc.FollowRules -
deleteRelation(relation, originTag, destinationTag)
-
Removes a relation between two instances on the specified destination
Parameters:
Name Type Description relation
string Type of the relation
originTag
string Origin instance tag
destinationTag
string Destination instance tag
-
getGlobalPatch()
-
Return the patch containing all the operations united
Returns:
-
getInstanceVersion(tag)
-
Gets the version of the specified instance inside the patch
Parameters:
Name Type Description tag
string Instance tag
Returns:
Instance version if found in patch
- Type
- number | undefined
-
getPatches()
-
Return an iterator over all patch and their destination
Returns:
- Type
- Map.<string, !olympe.dc.db.GraphPatch>
-
getSize()
-
Returns the number of generated patches
Returns:
- Type
- number
-
isEmpty()
-
Returns true if the patch generator is empty
Returns:
- Type
- boolean
-
isPersistedInstance(tag)
-
Return whether the specified instance is marked as persisted or not, considering this transaction.
Parameters:
Name Type Description tag
string Returns:
- Type
- boolean
-
persist(persist)
-
Sets the persist flag. If true, force all instances to be created locally, even if they have a remote source
Parameters:
Name Type Description persist
boolean -
setInstanceDeleted(tag)
-
Marks an instance as deleted`
Parameters:
Name Type Description tag
string -
<package> updatedInstances()
-
Return the list of instances updated or created in this transaction.
Returns:
- Type
- Iterable.<string>
-
updateInstance(tag [, properties] [, forceUpdate])
-
Updates an instance.
Parameters:
Name Type Argument Default Description tag
string Instance tag
properties
Map.<string, ?*> <optional>
Instance properties
forceUpdate
boolean <optional>
false If true, do not do any version check and accepts any update (used by rollbacks)
Type Definitions
-
PatchApplier(destination, patch)
-
Parameters:
Name Type Description destination
string patch
olympe.dc.db.GraphPatch