@sec-block/secjs-group
v1.0.3
Published
sec blockchain group ID class
Downloads
10
Readme
[]
SECGroup
This package is for SEC blockchain user account group related operations
- SECGroup
- new SECGroup(config)
- .reset(config) => None
- .generateGroupId() => Number
- .generateGroupIds(peerAddrList) => None
- .getGroupId(accAddr) => Number
- .setGroupId(accAddr, groupId) => None
- .updateStatisticsDht(peerAccGroupIdDht) => None
- .setGroupIdDht() => None
- .storeGroupIdTableToFile(file, content) => None
new SECGroup(config)
| Param | Type | Description | | --- | --- | --- | | config | Object | JSON format configurations for initialization |
secGroup.reset(config) => None
Reset this class
Kind: instance method of SECGroup
| Param | Type | Description | | --- | --- | --- | | config | Object | JSON format configuration |
secGroup.generateGroupId() => Number
Generate a group id
Kind: instance method of SECGroup
secGroup.generateGroupIds(peerAddrList) => None
This function generates group ids for all the peer nodes
Kind: instance method of SECGroup
| Param | Type | Description | | --- | --- | --- | | peerAddrList | Array | Peer nodes' address list |
secGroup.getGroupId(accAddr) => Number
This function returns the group ID for a specific address
Kind: instance method of SECGroup
| Param | Type | Description | | --- | --- | --- | | accAddr | String | Account address |
secGroup.setGroupId(accAddr, groupId) => None
This function sets the group ID for a specific address
Kind: instance method of SECGroup
| Param | Type | Description | | --- | --- | --- | | accAddr | String | Account address | | groupId | Number | Group ID value which will be set to the corresponding account address |
secGroup.updateStatisticsDht(peerAccGroupIdDht) => None
This function updates the table which stores the frequency of each group ID generated by its peer nodes
Kind: instance method of SECGroup
| Param | Type | Description | | --- | --- | --- | | peerAccGroupIdDht | Object | Other peer nodes generated group ID table |
secGroup.setGroupIdDht() => None
This function finally determined the located group ID for each node (unchangable during this working period). If there are two group IDs have the same value, then pick up the smaller one as its group ID
Kind: instance method of SECGroup
secGroup.storeGroupIdTableToFile(file, content) => None
This function writes(appends) the group ID statistics table into a JSON file
Kind: instance method of SECGroup
| Param | Type | Description | | --- | --- | --- | | file | String | The json file path and name | | content | Object | Data to be written, default data is 'this.accGroupIdDht' |