victor-axelsson / id2210

0 stars 0 forks source link

Clear #5

Closed victor-axelsson closed 7 years ago

victor-axelsson commented 7 years ago

About

Implement the following functions in Context class:

  private def clearReg(deps:List[Int], regT:regT) = {
    //TODO: shiet
  }

  def clearElem(ints: List[Int], key: Key) = {
    //TODO: implement
  }

  def clearMap(ints: List[Int], t: mapT) = {
    //TODO: implement
  }

  def clearList(ints: List[Int], t: listT) = {
    //TODO: implement
  }

The specification from the paper:

skarmavbild 2017-05-18 kl 13 27 55 skarmavbild 2017-05-18 kl 13 24 55 skarmavbild 2017-05-18 kl 13 24 23 skarmavbild 2017-05-18 kl 13 25 44

About clearing:

In turn, CLEAR-ELEM uses CLEAR-ANY to clear out any data with a given key, regardless of whether it is of type mapT, listT or regT, and also updates the presence set to include any nested operation IDs, but exclude any operations in deps .

CLEAR-NONE

skarmavbild 2017-05-18 kl 13 34 12

[..] "or by CLEAR-NONE (which does nothing) if the key is absent."

CLEAR-ANY

skarmavbild 2017-05-18 kl 13 30 56

The premises of CLEAR-ANY are satisfied by CLEAR-MAP1, CLEAR-LIST1 and CLEAR-REG if the respective key appears in ctx, or by CLEAR-NONE (which does nothing) if the key is absent. As defined by the ASSIGN rule, a register maintains a mapping from operation IDs to values. CLEAR-REG updates a register by removing all operation IDs that appear in deps (i.e., which causally precede the clearing operation), but retaining all operation IDs that do not appear in deps (from assignment operations that are concurrent with the clearing operation).

Clearing maps and lists takes a similar approach: each element of the map or list is recursively cleared using clearElem, and presence sets are updated to exclude deps. Thus, any list elements or map entries whose modifications causally precede the clearing operation will end up with empty presence sets, and thus be considered deleted. Any map or list elements containing operations that are concur- rent with the clearing operation are preserved.

victor-axelsson commented 7 years ago

About

This should be working. The only exception to this is clearing of lists. Since we have lazy creation when we use evalExpr and evalCmd this kind of renders the clearList unnecessary. At least for now.

Clear List

For now, I'm going to close this issue because if there should be ay issues with clearList this issue can be reopened. But preferable a separate issue should be created, beacuse this issue is kind of too big for this separate issue.