pamoja for TypeScript - v0.1.17
    Preparing search index...

    Class Router

    One node routing table, learned from the traffic the node hears.

    Index
    • Creates an empty routing table for a node at address.

      capacity is how many routes to make room for, defaulting to [ROUTING_DEFAULT_CAPACITY]. A capacity of zero floods every unknown destination, which is the behaviour with no table at all.

      Parameters

      • address: number
      • Optionalcapacity: number | null

      Returns Router

    • get address(): number

      The address this router answers for.

      Returns number

    • get capacity(): number

      How many routes the table can hold.

      Returns number

    • get isEmpty(): boolean

      Whether the table has learned nothing yet.

      Returns boolean

    • get len(): number

      How many routes the table currently holds.

      Returns number

    • Returns what the known route to dst costs, or null when none is known.

      Parameters

      • dst: number

      Returns number | null

    • Forgets the route to dst, for example after it stops answering.

      Parameters

      • dst: number

      Returns void

    • Returns the neighbour to send a packet to on the way to dst, or null.

      Parameters

      • dst: number

      Returns number | null

    • Learns a route from a packet that arrived.

      When a packet from origin comes in through neighbour via at cost, that neighbour is the way back. Returns whether the table changed.

      Parameters

      • origin: number
      • via: number
      • cost: number

      Returns boolean

    • Returns the whole route to dst, or null when none is known.

      Parameters

      • dst: number

      Returns Route | null