On this page

# InternalStateManager

### new InternalStateManager(logger)

The InternalStateManager constructor.

Parameters:

Name | Type | Description
--- | --- | ---
`logger` | Logger |

Source
  - models/internal.state.manager.js, line 17

## Extends

- EventEmitter2

## Classes

InternalStateManager

## Members

### (private) logger :Logger

Logger handler.

Type:

- Logger

Source
  - models/internal.state.manager.js, line 53

### (private) state :Object

The internal state to be stored and updated by this instance. The `state` property will hold:

- heartbeat information to be passed to worker threads for context
- other observed nodes (not registered in the working fleet)
- pending transactions (updates communicated to the node without any responses)
- network status as provided by the network supervisor

Type:

- Object

Source
  - models/internal.state.manager.js, line 28

### (private) threads :Object

Handlers for the message processing threads.

Type:

- Object

Source
  - models/internal.state.manager.js, line 41

## Methods

### broadcastIgnoreRequestId(requestId, watches)

Signals the registered threads to remove the watch for a specific session id.

Parameters:

Name | Type | Description
--- | --- | ---
`requestId` | string |
`watches` | Array.<string> |

Source
  - models/internal.state.manager.js, line 104

### broadcastRequestId(requestId, watches)

Broadcasts interest for a specific session id to all the registered threads. The session id will be used for correct routing of the received notifications from the network.

Parameters:

Name | Type | Description
--- | --- | ---
`requestId` | string |
`watches` | Array.<string> |

Source
  - models/internal.state.manager.js, line 87

### broadcastUpdateFleet(fleet)

Broadcasts working fleet to all registered threads.

Parameters:

Name | Type | Description
--- | --- | ---
`fleet` | Array.<string> |

Source
  - models/internal.state.manager.js, line 71

### (async) getNetworkSnapshot(supervisor) → {Promise.<Object>}

Returns the network information as received from the supervisors.

Parameters:

Name | Type | Description
--- | --- | ---
`supervisor` | string |

Source
  - models/internal.state.manager.js, line 212

Returns:

Type:
  Promise.<Object>

### (async) getNetworkSupervisors() → {Promise.<Array.<string>>}

Get the list of observed network supervisors.

Source
  - models/internal.state.manager.js, line 198

Returns:

Type:
  Promise.<Array.<string>>

### (async) getNodeInfo(node) → {Promise.<Object>}

Returns the processed heartbeat cached for a specific `node`.

Parameters:

Name | Type | Description
--- | --- | ---
`node` | string |

Source
  - models/internal.state.manager.js, line 172

Returns:

Type:
  Promise.<Object>

### (async) getUniverse() → {Promise.<ObservedNodes>}

Returns the list of all observed network nodes. An observed node is any of the nodes that published a payload, notification or heartbeat, which was intercepted by the worker threads, even if that message was discarded because it was not from the controlled working fleet.

Source
  - models/internal.state.manager.js, line 160

Returns:

Type:
  Promise.<ObservedNodes>

### (async) markNodeAsSeen(node, timestamp) → {Promise.<boolean>}

Will mark a specific node as seen in the dictionary of nodes.

Parameters:

Name | Type | Description
--- | --- | ---
`node` |  |
`timestamp` |  |

Source
  - models/internal.state.manager.js, line 227

Returns:

Type:
  Promise.<boolean>

### nodeInfoUpdate(info) → {InternalStateManager}

Stores the processed heartbeat data into the in-memory storage.

Parameters:

Name | Type | Description
--- | --- | ---
`info` | Object |

Source
  - models/internal.state.manager.js, line 121

Returns:

Type:
  InternalStateManager

### registerThread(threadType, thread) → {InternalStateManager}

Registers a worker thread handler for enabling communication from the StateManager towards the thread.

Parameters:

Name | Type | Description
--- | --- | ---
`threadType` | string |
`thread` | Object |

Source
  - models/internal.state.manager.js, line 242

Returns:

Type:
  InternalStateManager

### (async) updateNetworkSnapshot(supervisor, update) → {Promise.<boolean>}

Will store the network snapshot as seen from a specific supervisor node.

Parameters:

Name | Type | Description
--- | --- | ---
`supervisor` | string |
`update` | Object |

Source
  - models/internal.state.manager.js, line 185

Returns:

Type:
  Promise.<boolean>

Type anything to view search result