Package vinzclortho :: Module vectorclock :: Class VectorClock
[hide private]
[frames] | no frames]

Class VectorClock

source code

object --+
         |
        VectorClock

A vector clock implementation. Each node's clock is stored as a tuple: (clock, timestamp) in a dict with name as key. This means that the key needs to be hashable.

Inspired by: http://github.com/cliffmoon/dynomite/blob/master/elibs/vector_clock.erl

Instance Methods [hide private]
 
__init__(self, clocks=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__repr__(self)
repr(x)
source code
 
__str__(self)
str(x)
source code
 
clone(self)
Returns a copy of the vector clock
source code
 
prune(self)
This remove items so that it contains no items older than prune_age and a maximum of prune_size items.
source code
 
increment(self, name)
Increments the vector clock for name.
source code
 
__eq__(self, rhs) source code
 
__ne__(self, rhs) source code
 
descends_from(self, rhs)
Determines if rhs is an ancestor of self.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]
  prune_size = 10
  prune_age = 3600.0
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, clocks=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

increment(self, name)

source code 

Increments the vector clock for name.

Parameters:
  • name (hashable) - A unique identifier

descends_from(self, rhs)

source code 

Determines if rhs is an ancestor of self. Note that vc.descends_from(vc) returns True