Browse files

Outline of group method

  • Loading branch information...
1 parent bc9bf23 commit 5e53a9895284d846e4e2537f671cd0c5c20db966 @fd committed Feb 11, 2013
Showing with 7 additions and 24 deletions.
  1. +7 −24 runtime/methods_group.go
View
31 runtime/methods_group.go
@@ -40,36 +40,19 @@ func (op *group_op) Resolve(txn *Transaction, events chan<- event.Event) {
coll_key_b = cas.Collate(key_b)
}
- // skip when they are equal
+ // propagate event
+ // - to sub table at coll_key_b
+ // - to groups table
if bytes.Compare(coll_key_a, coll_key_b) == 0 {
continue
}
- // remove old entry
- if i_change.a != nil {
- key_addr, elt_addr, err := table.Del(coll_key_a)
- if err != nil {
- panic("runtime: " + err.Error())
- }
- events <- &ChangedMember{op.name, coll_key_a, key_addr, elt_addr, nil}
- }
-
- // add new entry
- if i_change.b != nil {
- key_addr, err := cas.Encode(txn.env.Store, key_b, -1)
- if err != nil {
- panic("runtime: " + err.Error())
- }
-
- prev_elt_addr, err := table.Set(coll_key_a, key_addr, i_change.b)
- if err != nil {
- panic("runtime: " + err.Error())
- }
-
- events <- &ChangedMember{op.name, coll_key_b, key_addr, prev_elt_addr, i_change.b}
- }
+ // remove old entry from sub table
+ // add new entry to sub table (while potentially adding new subtables)
}
+ // remove empty sub tables
+
tab_addr_a, tab_addr_b := txn.CommitTable(op.name, table)
events <- &ConsistentTable{op.name, tab_addr_a, tab_addr_b}
}

0 comments on commit 5e53a98

Please sign in to comment.