requestDataFromPeers takes roles
This commit is contained in:
parent
dc231ba982
commit
de6213b1b7
@ -212,6 +212,7 @@ export class Database {
|
||||
}
|
||||
const processId = diff.process_id;
|
||||
const stateId = diff.state_id;
|
||||
const roles = diff.roles;
|
||||
try {
|
||||
const valueBytes = await service.fetchValueFromStorage(hash);
|
||||
if (valueBytes) {
|
||||
@ -230,7 +231,7 @@ export class Database {
|
||||
console.log('Request data from managers of the process');
|
||||
// get the diff from db
|
||||
if (!requestedStateId.includes(stateId)) {
|
||||
await service.requestDataFromPeers(processId, stateId);
|
||||
await service.requestDataFromPeers(processId, [stateId], [roles]);
|
||||
requestedStateId.push(stateId);
|
||||
}
|
||||
}
|
||||
@ -264,8 +265,9 @@ export class Database {
|
||||
const diff = await service.getDiffByValue(hash);
|
||||
const processId = diff.process_id;
|
||||
const stateId = diff.state_id;
|
||||
const roles = diff.roles;
|
||||
if (!requestedStateId.includes(stateId)) {
|
||||
await service.requestDataFromPeers(processId, stateId);
|
||||
await service.requestDataFromPeers(processId, [stateId], [roles]);
|
||||
requestedStateId.push(stateId);
|
||||
}
|
||||
}
|
||||
|
@ -1195,9 +1195,11 @@ export default class Services {
|
||||
}
|
||||
}
|
||||
|
||||
public async requestDataFromPeers(processId: string, stateId: string) {
|
||||
public async requestDataFromPeers(processId: string, stateIds: string[], roles: Record<string, RoleDefinition>[]) {
|
||||
console.log('Requesting data from peers');
|
||||
console.log(roles);
|
||||
try {
|
||||
const res = this.sdkClient.request_data(processId, [stateId]);
|
||||
const res = this.sdkClient.request_data(processId, stateIds, roles);
|
||||
await this.handleApiReturn(res);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user