Beispiel #1
0
def getNeighbors():
    """
    Return the nodes to gossip with.
    This algorithm might be expanded later. Right now we just have a 
    constant group. Theoretically it would try a few and optimize to gossip 
    with the nearest nodes. Definitely an area for further design and 
    implementation.
    """
    global neighborStrategy
    if not neighborStrategy:
        neighborStrategy = neighbors.neighborStrategyFactory(
            config.GOSSIP_NEIGHBOR_STRATEGY)

    return neighborStrategy.getNeighbors()
Beispiel #2
0
def getNeighbors():
    """
    Return the nodes to gossip with.
    This algorithm might be expanded later. Right now we just have a 
    constant group. Theoretically it would try a few and optimize to gossip 
    with the nearest nodes. Definitely an area for further design and 
    implementation.
    """
    global neighborStrategy
    if not neighborStrategy:
        neighborStrategy = neighbors.neighborStrategyFactory(
            config.GOSSIP_NEIGHBOR_STRATEGY)

    return neighborStrategy.getNeighbors()
Beispiel #3
0
def init():
    """
    Initialize the connections.
    Let's get it started...in here!
    Developer note: the advantage of putting it here is
    that me.py doesn't need to import anything.
    """
    global neighborStrategy

    me.init(nodes.CurrentNode())
    debug("Init called. Node is " + me.getUid(), info=True)
    debug("#".join(["New", me.getMe().getShortUid(), me.getUid()]), 
        monitor=True)

    neighborStrategy = neighbors.neighborStrategyFactory(
        config.GOSSIP_NEIGHBOR_STRATEGY)
Beispiel #4
0
def init():
    """
    Initialize the connections.
    Let's get it started...in here!
    Developer note: the advantage of putting it here is
    that me.py doesn't need to import anything.
    """
    global neighborStrategy

    me.init(nodes.CurrentNode())
    debug("Init called. Node is " + me.getMe().getUid(), info=True)
    debug("#".join(["New", me.getMe().getShortUid(), me.getMe().getUid()]), 
        monitor=True)

    neighborStrategy = neighbors.neighborStrategyFactory(
        config.GOSSIP_NEIGHBOR_STRATEGY)