zkcloudworker 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/ts/src/api/api.d.ts +5 -4
- package/lib/ts/src/api/api.js +5 -4
- package/lib/ts/src/cloud/cloud.d.ts +51 -50
- package/lib/ts/src/cloud/cloud.js +33 -32
- package/lib/ts/src/cloud/local.d.ts +5 -5
- package/lib/ts/src/cloud/local.js +5 -5
- package/lib/ts/tsconfig.tsbuildinfo +1 -1
- package/lib/web/src/api/api.d.ts +5 -4
- package/lib/web/src/api/api.js +5 -4
- package/lib/web/src/api/api.js.map +1 -1
- package/lib/web/src/cloud/cloud.d.ts +51 -50
- package/lib/web/src/cloud/cloud.js +33 -32
- package/lib/web/src/cloud/cloud.js.map +1 -1
- package/lib/web/src/cloud/local.d.ts +5 -5
- package/lib/web/src/cloud/local.js +5 -5
- package/lib/web/tsconfig.web.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -60,19 +60,20 @@ export declare abstract class Cloud {
|
|
60
60
|
readonly isLocalCloud: boolean;
|
61
61
|
/**
|
62
62
|
* Constructor for the Cloud class
|
63
|
-
* @param
|
64
|
-
* @param
|
65
|
-
* @param
|
66
|
-
* @param
|
67
|
-
* @param
|
68
|
-
* @param
|
69
|
-
* @param
|
70
|
-
* @param
|
71
|
-
* @param
|
72
|
-
* @param
|
73
|
-
* @param
|
74
|
-
* @param
|
75
|
-
* @param
|
63
|
+
* @param params the parameters for the Cloud class
|
64
|
+
* @param params.id the id of the user
|
65
|
+
* @param params.jobId the job id
|
66
|
+
* @param params.stepId the step id
|
67
|
+
* @param params.taskId the task id
|
68
|
+
* @param params.cache the cache folder. Use it to get the Cache object: cache = Cache.FileSystem(this.cloud.cache);
|
69
|
+
* @param params.developer the developer id
|
70
|
+
* @param params.repo the repo id
|
71
|
+
* @param params.task the task id
|
72
|
+
* @param params.userId the user id
|
73
|
+
* @param params.args the arguments, should be a string or serialized JSON
|
74
|
+
* @param params.metadata the metadata, should be a string or serialized JSON
|
75
|
+
* @param params.chain the blockchain network
|
76
|
+
* @param params.isLocalCloud a boolean to check if the cloud is local or not
|
76
77
|
*/
|
77
78
|
constructor(params: {
|
78
79
|
id: string;
|
@@ -98,10 +99,10 @@ export declare abstract class Cloud {
|
|
98
99
|
abstract getDeployer(): Promise<DeployerKeyPair | undefined>;
|
99
100
|
/**
|
100
101
|
* Abstract method to release the deployer
|
101
|
-
* @param params
|
102
|
+
* @param params the public key of the deployer and the transactions hashes
|
102
103
|
* Used to release the deployer after the transactions are sent to the blockchain
|
103
|
-
* @param publicKey
|
104
|
-
* @param txsHashes
|
104
|
+
* @param params.publicKey the public key of the deployer
|
105
|
+
* @param params.txsHashes the transactions hashes
|
105
106
|
*/
|
106
107
|
abstract releaseDeployer(params: {
|
107
108
|
publicKey: string;
|
@@ -110,46 +111,46 @@ export declare abstract class Cloud {
|
|
110
111
|
/**
|
111
112
|
* Abstract method to get the data by key
|
112
113
|
* Used to get the data by key from the cloud storage
|
113
|
-
* @param key
|
114
|
+
* @param key the key
|
114
115
|
* @returns the value of the key
|
115
116
|
*/
|
116
117
|
abstract getDataByKey(key: string): Promise<string | undefined>;
|
117
118
|
/**
|
118
119
|
* Abstract method to save the data by key
|
119
120
|
* Used to save the data by key to the cloud storage
|
120
|
-
* @param key
|
121
|
-
* @param value
|
121
|
+
* @param key the key
|
122
|
+
* @param value the value
|
122
123
|
*/
|
123
124
|
abstract saveDataByKey(key: string, value: string | undefined): Promise<void>;
|
124
125
|
/**
|
125
126
|
* Abstract method to save the file
|
126
127
|
* Used to save the file to the cloud storage
|
127
|
-
* @param filename
|
128
|
-
* @param value
|
128
|
+
* @param filename the filename
|
129
|
+
* @param value the value
|
129
130
|
*/
|
130
131
|
abstract saveFile(filename: string, value: Buffer): Promise<void>;
|
131
132
|
/**
|
132
133
|
* Abstract method to load the file
|
133
134
|
* Used to load the file from the cloud storage
|
134
|
-
* @param filename
|
135
|
+
* @param filename the filename
|
135
136
|
* @returns the value of the file
|
136
137
|
*/
|
137
138
|
abstract loadFile(filename: string): Promise<Buffer | undefined>;
|
138
139
|
/**
|
139
140
|
* Abstract method to load the environment
|
140
141
|
* Used to load the environment from the cloud storage
|
141
|
-
* @param password
|
142
|
+
* @param password the password
|
142
143
|
*/
|
143
144
|
abstract loadEnvironment(password: string): Promise<void>;
|
144
145
|
/**
|
145
146
|
* Abstract method to calculate the recursive proof
|
146
147
|
* Used to calculate the recursive proof
|
147
|
-
* @param data
|
148
|
-
* @param data.transactions
|
149
|
-
* @param data.task
|
150
|
-
* @param data.userId
|
151
|
-
* @param data.args
|
152
|
-
* @param data.metadata
|
148
|
+
* @param data the data
|
149
|
+
* @param data.transactions the transactions
|
150
|
+
* @param data.task the task
|
151
|
+
* @param data.userId the user id
|
152
|
+
* @param data.args the arguments
|
153
|
+
* @param data.metadata the metadata
|
153
154
|
* @returns the proof
|
154
155
|
*/
|
155
156
|
abstract recursiveProof(data: {
|
@@ -162,12 +163,12 @@ export declare abstract class Cloud {
|
|
162
163
|
/**
|
163
164
|
* Abstract method to execute the transactions
|
164
165
|
* Used to execute the transactions
|
165
|
-
* @param data
|
166
|
-
* @param data.transactions
|
167
|
-
* @param data.task
|
168
|
-
* @param data.userId
|
169
|
-
* @param data.args
|
170
|
-
* @param data.metadata
|
166
|
+
* @param data the data
|
167
|
+
* @param data.transactions the transactions
|
168
|
+
* @param data.task the task
|
169
|
+
* @param data.userId the user id
|
170
|
+
* @param data.args the arguments
|
171
|
+
* @param data.metadata the metadata
|
171
172
|
* @returns the result
|
172
173
|
*/
|
173
174
|
abstract execute(data: {
|
@@ -180,13 +181,13 @@ export declare abstract class Cloud {
|
|
180
181
|
/**
|
181
182
|
* Abstract method to add the task
|
182
183
|
* Used to add the task
|
183
|
-
* @param data
|
184
|
-
* @param data.task
|
185
|
-
* @param data.startTime
|
186
|
-
* @param data.userId
|
187
|
-
* @param data.args
|
188
|
-
* @param data.metadata
|
189
|
-
* @param data.maxAttempts
|
184
|
+
* @param data the data
|
185
|
+
* @param data.task the task
|
186
|
+
* @param data.startTime the start time
|
187
|
+
* @param data.userId the user id
|
188
|
+
* @param data.args the arguments
|
189
|
+
* @param data.metadata the metadata
|
190
|
+
* @param data.maxAttempts the maximum attempts
|
190
191
|
* @returns the task id
|
191
192
|
*/
|
192
193
|
abstract addTask(data: {
|
@@ -200,7 +201,7 @@ export declare abstract class Cloud {
|
|
200
201
|
/**
|
201
202
|
* Abstract method to delete the transaction
|
202
203
|
* Used to delete the transaction
|
203
|
-
* @param txId
|
204
|
+
* @param txId the transaction id
|
204
205
|
*/
|
205
206
|
abstract deleteTransaction(txId: string): Promise<void>;
|
206
207
|
/**
|
@@ -212,7 +213,7 @@ export declare abstract class Cloud {
|
|
212
213
|
/**
|
213
214
|
* Abstract method to delete the task
|
214
215
|
* Used to delete the task
|
215
|
-
* @param taskId
|
216
|
+
* @param taskId the task id
|
216
217
|
*/
|
217
218
|
abstract deleteTask(taskId: string): Promise<void>;
|
218
219
|
/**
|
@@ -222,7 +223,7 @@ export declare abstract class Cloud {
|
|
222
223
|
/**
|
223
224
|
* Abstract method to get the job result
|
224
225
|
* Used to get the job result
|
225
|
-
* @param jobId
|
226
|
+
* @param jobId the job id
|
226
227
|
* @returns the job result
|
227
228
|
*/
|
228
229
|
abstract jobResult(jobId: string): Promise<JobData | undefined>;
|
@@ -237,7 +238,7 @@ export declare abstract class zkCloudWorker {
|
|
237
238
|
readonly cloud: Cloud;
|
238
239
|
/**
|
239
240
|
* Constructor for the zkCloudWorker class
|
240
|
-
* @param cloud
|
241
|
+
* @param cloud the cloud instance provided by the zkCloudWorker in the local environment or in the cloud
|
241
242
|
*/
|
242
243
|
constructor(cloud: Cloud);
|
243
244
|
/**
|
@@ -247,20 +248,20 @@ export declare abstract class zkCloudWorker {
|
|
247
248
|
deployedContracts(): Promise<DeployedSmartContract[]>;
|
248
249
|
/**
|
249
250
|
* Creates a new proof from a transaction
|
250
|
-
* @param transaction
|
251
|
+
* @param transaction the transaction
|
251
252
|
* @returns the serialized proof
|
252
253
|
*/
|
253
254
|
create(transaction: string): Promise<string | undefined>;
|
254
255
|
/**
|
255
256
|
* Merges two proofs
|
256
|
-
* @param proof1
|
257
|
-
* @param proof2
|
257
|
+
* @param proof1 the first proof
|
258
|
+
* @param proof2 the second proof
|
258
259
|
* @returns the merged proof
|
259
260
|
*/
|
260
261
|
merge(proof1: string, proof2: string): Promise<string | undefined>;
|
261
262
|
/**
|
262
263
|
* Executes the transactions
|
263
|
-
* @param transactions
|
264
|
+
* @param transactions the transactions, can be empty list
|
264
265
|
* @returns the result
|
265
266
|
*/
|
266
267
|
execute(transactions: string[]): Promise<string | undefined>;
|
@@ -1,37 +1,38 @@
|
|
1
1
|
/*
|
2
|
-
* Abstract class for the cloud
|
2
|
+
* Abstract class for the cloud service
|
3
3
|
* Used to define the cloud methods and properties
|
4
4
|
* Should be implemented by for local testing and for the zkCloudWorker in the cloud
|
5
|
-
* @param id
|
6
|
-
* @param jobId
|
7
|
-
* @param stepId
|
8
|
-
* @param taskId
|
9
|
-
* @param cache
|
10
|
-
* @param developer
|
11
|
-
* @param repo
|
12
|
-
* @param task
|
13
|
-
* @param userId
|
14
|
-
* @param args
|
15
|
-
* @param metadata
|
16
|
-
* @param chain
|
17
|
-
* @param isLocalCloud
|
5
|
+
* @param id the id of the user
|
6
|
+
* @param jobId the job id
|
7
|
+
* @param stepId the step id
|
8
|
+
* @param taskId the task id
|
9
|
+
* @param cache the cache folder. Use it to get the Cache object: cache = Cache.FileSystem(this.cloud.cache);
|
10
|
+
* @param developer the developer id
|
11
|
+
* @param repo the repo id
|
12
|
+
* @param task the task id
|
13
|
+
* @param userId the user id
|
14
|
+
* @param args the arguments, should be a string or serialized JSON
|
15
|
+
* @param metadata the metadata, should be a string or serialized JSON
|
16
|
+
* @param chain the blockchain network
|
17
|
+
* @param isLocalCloud a boolean to check if the cloud is local or not
|
18
18
|
*/
|
19
19
|
export class Cloud {
|
20
20
|
/**
|
21
21
|
* Constructor for the Cloud class
|
22
|
-
* @param
|
23
|
-
* @param
|
24
|
-
* @param
|
25
|
-
* @param
|
26
|
-
* @param
|
27
|
-
* @param
|
28
|
-
* @param
|
29
|
-
* @param
|
30
|
-
* @param
|
31
|
-
* @param
|
32
|
-
* @param
|
33
|
-
* @param
|
34
|
-
* @param
|
22
|
+
* @param params the parameters for the Cloud class
|
23
|
+
* @param params.id the id of the user
|
24
|
+
* @param params.jobId the job id
|
25
|
+
* @param params.stepId the step id
|
26
|
+
* @param params.taskId the task id
|
27
|
+
* @param params.cache the cache folder. Use it to get the Cache object: cache = Cache.FileSystem(this.cloud.cache);
|
28
|
+
* @param params.developer the developer id
|
29
|
+
* @param params.repo the repo id
|
30
|
+
* @param params.task the task id
|
31
|
+
* @param params.userId the user id
|
32
|
+
* @param params.args the arguments, should be a string or serialized JSON
|
33
|
+
* @param params.metadata the metadata, should be a string or serialized JSON
|
34
|
+
* @param params.chain the blockchain network
|
35
|
+
* @param params.isLocalCloud a boolean to check if the cloud is local or not
|
35
36
|
*/
|
36
37
|
constructor(params) {
|
37
38
|
const { id, jobId, stepId, taskId, cache, developer, repo, task, userId, args, metadata, isLocalCloud, chain, } = params;
|
@@ -59,7 +60,7 @@ export class Cloud {
|
|
59
60
|
export class zkCloudWorker {
|
60
61
|
/**
|
61
62
|
* Constructor for the zkCloudWorker class
|
62
|
-
* @param cloud
|
63
|
+
* @param cloud the cloud instance provided by the zkCloudWorker in the local environment or in the cloud
|
63
64
|
*/
|
64
65
|
constructor(cloud) {
|
65
66
|
this.cloud = cloud;
|
@@ -74,7 +75,7 @@ export class zkCloudWorker {
|
|
74
75
|
// Those methods should be implemented for recursive proofs calculations
|
75
76
|
/**
|
76
77
|
* Creates a new proof from a transaction
|
77
|
-
* @param transaction
|
78
|
+
* @param transaction the transaction
|
78
79
|
* @returns the serialized proof
|
79
80
|
*/
|
80
81
|
async create(transaction) {
|
@@ -82,8 +83,8 @@ export class zkCloudWorker {
|
|
82
83
|
}
|
83
84
|
/**
|
84
85
|
* Merges two proofs
|
85
|
-
* @param proof1
|
86
|
-
* @param proof2
|
86
|
+
* @param proof1 the first proof
|
87
|
+
* @param proof2 the second proof
|
87
88
|
* @returns the merged proof
|
88
89
|
*/
|
89
90
|
async merge(proof1, proof2) {
|
@@ -92,7 +93,7 @@ export class zkCloudWorker {
|
|
92
93
|
// Those methods should be implemented for anything except for recursive proofs
|
93
94
|
/**
|
94
95
|
* Executes the transactions
|
95
|
-
* @param transactions
|
96
|
+
* @param transactions the transactions, can be empty list
|
96
97
|
* @returns the result
|
97
98
|
*/
|
98
99
|
async execute(transactions) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cloud.js","sourceRoot":"","sources":["../../../../../src/cloud/cloud.ts"],"names":[],"mappings":"AA8CA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAgB,KAAK;IAezB
|
1
|
+
{"version":3,"file":"cloud.js","sourceRoot":"","sources":["../../../../../src/cloud/cloud.ts"],"names":[],"mappings":"AA8CA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAgB,KAAK;IAezB;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY,MAcX;QACC,MAAM,EACJ,EAAE,EACF,KAAK,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,KAAK,GACN,GAAG,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,KAAK,CAAC;QAC1C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CA2JF;AAED;;;;;GAKG;AACH,MAAM,OAAgB,aAAa;IAGjC;;;OAGG;IACH,YAAY,KAAY;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,iBAAiB;QACrB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,wEAAwE;IACxE;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,WAAmB;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,MAAc;QACxC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,+EAA+E;IAC/E;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,YAAsB;QAClC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,mBAAmB,CAAC,YAAgC,IAAkB,CAAC;IAE7E;;;OAGG;IACH,KAAK,CAAC,IAAI;QACR,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
@@ -17,11 +17,11 @@ export declare class LocalCloud extends Cloud {
|
|
17
17
|
/**
|
18
18
|
* Constructor for LocalCloud
|
19
19
|
* @param params the parameters to create the LocalCloud
|
20
|
-
* @param job the job data
|
21
|
-
* @param chain the blockchain to execute the job on, can be any blockchain, not only local
|
22
|
-
* @param cache the cache folder
|
23
|
-
* @param stepId the step id
|
24
|
-
* @param localWorker the worker to execute the tasks
|
20
|
+
* @param params.job the job data
|
21
|
+
* @param params.chain the blockchain to execute the job on, can be any blockchain, not only local
|
22
|
+
* @param params.cache the cache folder
|
23
|
+
* @param params.stepId the step id
|
24
|
+
* @param params.localWorker the worker to execute the tasks
|
25
25
|
*/
|
26
26
|
constructor(params: {
|
27
27
|
job: JobData;
|
@@ -12,11 +12,11 @@ export class LocalCloud extends Cloud {
|
|
12
12
|
/**
|
13
13
|
* Constructor for LocalCloud
|
14
14
|
* @param params the parameters to create the LocalCloud
|
15
|
-
* @param job the job data
|
16
|
-
* @param chain the blockchain to execute the job on, can be any blockchain, not only local
|
17
|
-
* @param cache the cache folder
|
18
|
-
* @param stepId the step id
|
19
|
-
* @param localWorker the worker to execute the tasks
|
15
|
+
* @param params.job the job data
|
16
|
+
* @param params.chain the blockchain to execute the job on, can be any blockchain, not only local
|
17
|
+
* @param params.cache the cache folder
|
18
|
+
* @param params.stepId the step id
|
19
|
+
* @param params.localWorker the worker to execute the tasks
|
20
20
|
*/
|
21
21
|
constructor(params) {
|
22
22
|
const { job, chain, cache, stepId, localWorker } = params;
|