Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
rkamysz committed Aug 3, 2023
1 parent bea4077 commit b95c0e0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"typescript": "^4.8.2"
},
"dependencies": {
"@alien-worlds/aw-broadcast": "^0.0.5",
"@alien-worlds/aw-core": "^0.0.6",
"@alien-worlds/aw-broadcast": "^0.0.6",
"@alien-worlds/aw-core": "^0.0.13",
"@alien-worlds/aw-workers": "^0.0.2",
"async": "^3.2.4",
"commander": "^10.0.1",
Expand Down
4 changes: 2 additions & 2 deletions src/filter/filter.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default class FilterWorker extends Worker<FilterSharedData> {
const { name, rows } = delta;

for (const row of rows) {
const info = serializer.deserializeTableRow(row);
const info = await serializer.deserializeTableRow(row);

if (!info) {
// The contract may not contain tables or may be corrupted
Expand Down Expand Up @@ -205,7 +205,7 @@ export default class FilterWorker extends Worker<FilterSharedData> {
dependencies: { serializer, processorTaskQueue },
} = this;

const deserializedBlock = serializer.deserializeBlock<
const deserializedBlock = await serializer.deserializeBlock<
BlockModel<SignedBlock, [TraceByName], [DeltaByName]>,
BlockModel
>(json);
Expand Down
16 changes: 8 additions & 8 deletions src/processor/processor.model.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { deserialize } from 'v8';
export class ProcessorModelFactory {
constructor(protected serializer: Serializer) {}

protected buildActionTraceProcessorModel<DataType = unknown>(
protected async buildActionTraceProcessorModel<DataType = unknown>(
model: ProcessorTask
): ActionTraceProcessorModel<DataType> {
): Promise<ActionTraceProcessorModel<DataType>> {
const { serializer } = this;
const { abi, content: buffer } = model;
const content: ActionProcessorContentModel = deserialize(buffer);
Expand All @@ -27,7 +27,7 @@ export class ProcessorModelFactory {

const [receiptType, receiptContent] = receipt;
const { global_sequence, recv_sequence } = receiptContent;
const data = serializer.deserializeActionData<DataType>(
const data = await serializer.deserializeActionData<DataType>(
act.account,
act.name,
act.data,
Expand All @@ -46,14 +46,14 @@ export class ProcessorModelFactory {
};
}

protected buildDeltaProcessorModel<DataType = unknown>(
protected async buildDeltaProcessorModel<DataType = unknown>(
model: ProcessorTask
): DeltaProcessorModel<DataType> {
): Promise<DeltaProcessorModel<DataType>> {
const { serializer } = this;
const { abi, content: buffer } = model;
const delta: DeltaProcessorContentModel = deserialize(buffer);
const { name, block_num, block_timestamp } = delta;
const row = serializer.deserializeTableRow<DataType>(delta, abi);
const row = await serializer.deserializeTableRow<DataType>(delta, abi);
const { code, scope, table, primary_key, payer, data, present } = row;

return {
Expand All @@ -70,9 +70,9 @@ export class ProcessorModelFactory {
};
}

public create<DataType = unknown>(
public async create<DataType = unknown>(
task: ProcessorTask
): ActionTraceProcessorModel<DataType> | DeltaProcessorModel<DataType> {
): Promise<ActionTraceProcessorModel<DataType> | DeltaProcessorModel<DataType>> {
if (task.type === ProcessorTaskType.Trace) {
return this.buildActionTraceProcessorModel(task);
} else if (task.type === ProcessorTaskType.Delta) {
Expand Down
2 changes: 1 addition & 1 deletion src/processor/processor.runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class ProcessorRunner {
workerPool.releaseWorker(id);
});

const model = this.modelFactory.create(task);
const model = await this.modelFactory.create(task);

// start worker
worker.run(model);
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# yarn lockfile v1


"@alien-worlds/aw-broadcast@^0.0.5":
version "0.0.5"
resolved "https://npm.pkg.github.com/download/@alien-worlds/aw-broadcast/0.0.5/2f6d4d0c6cfe8b039efd758a40ad23d18bee2efd#2f6d4d0c6cfe8b039efd758a40ad23d18bee2efd"
integrity sha512-fPMAZKLxzhK0ZJWQ5LYZaaRnwnZgsGdDvlZCwd2rY8I/j/elTpJ/N2hJ85GJaHgp1EmICj7o7+R3INkasXLGyg==
"@alien-worlds/aw-broadcast@^0.0.6":
version "0.0.6"
resolved "https://npm.pkg.github.com/download/@alien-worlds/aw-broadcast/0.0.6/361699552df577c674cfd07d55a89173a8ec69a1#361699552df577c674cfd07d55a89173a8ec69a1"
integrity sha512-n08okhDoxCr1urpCpKXlXXUcqz2MO7ifjz4jGkgwJgjycJvgi8qm5O5t6HVRjv9MYV3OSJSjAoYls8Q6sPFdHQ==
dependencies:
"@alien-worlds/aw-core" "^0.0.6"
"@alien-worlds/aw-core" "^0.0.13"
nanoid "^3.0.0"

"@alien-worlds/aw-core@^0.0.6":
version "0.0.6"
resolved "https://npm.pkg.github.com/download/@alien-worlds/aw-core/0.0.6/fdacb74371b9b80f311ff293e0ad4c5f8e105db5#fdacb74371b9b80f311ff293e0ad4c5f8e105db5"
integrity sha512-vrYMF1pA4LJqOvv3DaZ12WtmUdUkxrxjrmT+Zq5czu5N2VWw/XcrAygThCdBfGBwFS7WZBF93r46uf1BXGFC8w==
"@alien-worlds/aw-core@^0.0.13":
version "0.0.13"
resolved "https://npm.pkg.github.com/download/@alien-worlds/aw-core/0.0.13/f9d8ad2b2db4b99c52da69c075a4c34950602e73#f9d8ad2b2db4b99c52da69c075a4c34950602e73"
integrity sha512-v82R+oqik+3IaXH9KllFQGOfkP9P6C97zTt++TleWlB1V7wQdQdFtItgN/0eEo+VdHjdmUryLUEkQM4WNn1kyw==
dependencies:
inversify "^6.0.1"
node-fetch "2.6.6"
Expand Down

0 comments on commit b95c0e0

Please sign in to comment.