gossipy module#
Module contents#
- gossipy.CACHE = {}#
The models’ cache.
All models that are exchanged between nodes are temporarely stored in the cache. If a model is needed by another node, it is retrieved from the cache and only one copy remains active in memory. If a model is not referenced anymore, it is automatically removed from the cache. The models contained in the cache are a deep copy of the models stored in the nodes.
- class gossipy.CacheItem(value)#
Bases:
gossipy.Sizeable
The class of an item in the cache.
The constructor initializes the cache item with the specified value and with a single reference.
- Parameters
value (Any) – The value of the item.
- del_ref()#
Deletes a reference to the item.
- Returns
The value of the unreferenced item.
- Return type
Any
- get()#
Returns the value.
- Returns
The value of the item.
- Return type
Any
- get_size()#
Returns the size of the object.
The size is intended to be the number of “atomic” objects that the object contains. For example, a list of integers would have a size of the number of integers.
- Returns
The size of the object.
- Return type
- class gossipy.CacheKey(*args)#
Bases:
gossipy.Sizeable
The key for a cache item.
- get()#
Returns the value of the cache item.
- Returns
The value of the cache item.
- Return type
Any
- gossipy.LOG = <Logger rich (INFO)>#
The logging handler that filters out duplicate messages.
- class gossipy.Sizeable#
Bases:
abc.ABC
The interface for objects that can be sized.
Each class that implements this interface must define the method
get_size()
.