viff

changeset 594:770b59e49e81

Renamed Runtime.callback to Runtime.schedule_callback.
author Martin Geisler <mg@daimi.au.dk>
date Sat, 22 Mar 2008 14:59:27 +0100
parents b892c3460a13
children 3630428d6a51
files NEWS viff/comparison.py viff/runtime.py viff/test/test_basic_runtime.py
diffstat 4 files changed, 16 insertions(+), 14 deletions(-) [+]
line diff
     1.1 --- a/NEWS	Sat Mar 22 14:41:00 2008 +0100
     1.2 +++ b/NEWS	Sat Mar 22 14:59:27 2008 +0100
     1.3 @@ -18,7 +18,8 @@
     1.4  
     1.5  The Runtime class has been split into several parts and two new mixin
     1.6  classes provide different comparison protocols. Several coercion
     1.7 -problems were fixed.
     1.8 +problems were fixed. The Runtime.callback method was renamed to
     1.9 +Runtime.schedule_callback.
    1.10  
    1.11  Details:
    1.12  
     2.1 --- a/viff/comparison.py	Sat Mar 22 14:41:00 2008 +0100
     2.2 +++ b/viff/comparison.py	Sat Mar 22 14:59:27 2008 +0100
     2.3 @@ -94,7 +94,7 @@
     2.4          T = self.open(2**t - int_b + a)
     2.5  
     2.6          result = gather_shares([T] + bit_bits)
     2.7 -        self.callback(result, self._finish_greater_than_equal, l)
     2.8 +        self.schedule_callback(result, self._finish_greater_than_equal, l)
     2.9          return result
    2.10  
    2.11      @increment_pc
    2.12 @@ -268,9 +268,9 @@
    2.13          z = share_a - share_b + 2**l
    2.14          c = self.open(r_full + z)
    2.15  
    2.16 -        self.callback(c, self._finish_greater_than_equal,
    2.17 -                      field, smallField, s_bit, s_sign, mask,
    2.18 -                      r_modl, r_bits, z)
    2.19 +        self.schedule_callback(c, self._finish_greater_than_equal,
    2.20 +                               field, smallField, s_bit, s_sign, mask,
    2.21 +                               r_modl, r_bits, z)
    2.22          return c
    2.23  
    2.24      @increment_pc
     3.1 --- a/viff/runtime.py	Sat Mar 22 14:41:00 2008 +0100
     3.2 +++ b/viff/runtime.py	Sat Mar 22 14:59:27 2008 +0100
     3.3 @@ -501,7 +501,7 @@
     3.4          dl = DeferredList(vars)
     3.5          dl.addCallback(lambda _: self.shutdown())
     3.6  
     3.7 -    def callback(self, deferred, func, *args, **kwargs):
     3.8 +    def schedule_callback(self, deferred, func, *args, **kwargs):
     3.9          """Schedule a callback on a deferred with the correct program
    3.10          counter.
    3.11  
    3.12 @@ -659,14 +659,14 @@
    3.13                          d = Share(self, share.field, (share.field(id), share))
    3.14                      else:
    3.15                          d = self._expect_share(id, share.field)
    3.16 -                        self.callback(d, lambda s, id: (s.field(id), s), id)
    3.17 +                        self.schedule_callback(d, lambda s, id: (s.field(id), s), id)
    3.18                      deferreds.append(d)
    3.19                  # TODO: This list ought to trigger as soon as more than
    3.20                  # threshold shares has been received.
    3.21                  return self._recombine(deferreds, threshold)
    3.22  
    3.23          result = share.clone()
    3.24 -        self.callback(result, exchange)
    3.25 +        self.schedule_callback(result, exchange)
    3.26          if self.id in receivers:
    3.27              return result
    3.28  
    3.29 @@ -717,8 +717,9 @@
    3.30  
    3.31          result = gather_shares([share_a, share_b])
    3.32          result.addCallback(lambda (a, b): a * b)
    3.33 -        self.callback(result, self._shamir_share)
    3.34 -        self.callback(result, self._recombine, threshold=2*self.threshold)
    3.35 +        self.schedule_callback(result, self._shamir_share)
    3.36 +        self.schedule_callback(result, self._recombine,
    3.37 +                               threshold=2*self.threshold)
    3.38          return result
    3.39  
    3.40      @increment_pc
    3.41 @@ -853,7 +854,7 @@
    3.42                  # convert the resulting -1/1 share into a 0/1 share.
    3.43                  return Share(self, field, (share/root + 1) / 2)
    3.44  
    3.45 -        self.callback(result, finish, share, binary)
    3.46 +        self.schedule_callback(result, finish, share, binary)
    3.47          return result
    3.48  
    3.49      @increment_pc
     4.1 --- a/viff/test/test_basic_runtime.py	Sat Mar 22 14:41:00 2008 +0100
     4.2 +++ b/viff/test/test_basic_runtime.py	Sat Mar 22 14:59:27 2008 +0100
     4.3 @@ -67,7 +67,7 @@
     4.4              self.assertEquals(runtime.program_counter, [0])
     4.5  
     4.6          d = Deferred()
     4.7 -        runtime.callback(d, verify_program_counter)
     4.8 +        runtime.schedule_callback(d, verify_program_counter)
     4.9  
    4.10          runtime.synchronize()
    4.11          self.assertEquals(runtime.program_counter, [1])
    4.12 @@ -121,8 +121,8 @@
    4.13          def method_a(runtime):
    4.14              self.assertEquals(runtime.program_counter, [1, 0])
    4.15  
    4.16 -            runtime.callback(d1, verify_program_counter, 1)
    4.17 -            runtime.callback(d2, verify_program_counter, 2)
    4.18 +            runtime.schedule_callback(d1, verify_program_counter, 1)
    4.19 +            runtime.schedule_callback(d2, verify_program_counter, 2)
    4.20  
    4.21          method_a(runtime)
    4.22