24 lines
713 B
JavaScript
24 lines
713 B
JavaScript
const SKIP_PRIMORDIAL_SECTIONS = new Set([
|
|
'maestro',
|
|
'mysql',
|
|
'accessRights',
|
|
'systemMesh',
|
|
'arenaMesh',
|
|
])
|
|
|
|
export function getPrimordialDaemonIds(config = {}) {
|
|
const ids = []
|
|
for(const [section, block] of Object.entries(config)) {
|
|
if(SKIP_PRIMORDIAL_SECTIONS.has(section)) continue
|
|
if(!block || typeof(block) !== 'object' || Array.isArray(block)) continue
|
|
if(!block.primordialDaemon) continue
|
|
ids.push(typeof(block.senderId) === 'string' ? block.senderId : section)
|
|
}
|
|
return(ids)
|
|
}
|
|
|
|
export function buildPrepareQuorum(agentIds, config) {
|
|
const primordialIds = getPrimordialDaemonIds(config)
|
|
return([...agentIds, ...primordialIds])
|
|
}
|