1.0.3 • Published 6 years ago

@sec-block/secjs-group v1.0.3

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

JavaScript Style Guide

[JavaScript Style Guide]

SECGroup

This package is for SEC blockchain user account group related operations

new SECGroup(config)

ParamTypeDescription
configObjectJSON format configurations for initialization

secGroup.reset(config) => None

Reset this class

Kind: instance method of SECGroup

ParamTypeDescription
configObjectJSON 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

ParamTypeDescription
peerAddrListArrayPeer nodes' address list

secGroup.getGroupId(accAddr) => Number

This function returns the group ID for a specific address

Kind: instance method of SECGroup

ParamTypeDescription
accAddrStringAccount address

secGroup.setGroupId(accAddr, groupId) => None

This function sets the group ID for a specific address

Kind: instance method of SECGroup

ParamTypeDescription
accAddrStringAccount address
groupIdNumberGroup 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

ParamTypeDescription
peerAccGroupIdDhtObjectOther 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

ParamTypeDescription
fileStringThe json file path and name
contentObjectData to be written, default data is 'this.accGroupIdDht'
1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago