LocalCloud
Hierarchy
- Cloud
- LocalCloud
Index
Constructors
Properties
Methods
Constructors
constructor
Constructor for LocalCloud
Parameters
params: { cache?: string; chain: blockchain; job: JobData; localWorker: (cloud: Cloud) => Promise<zkCloudWorker>; stepId?: string }
the parameters to create the LocalCloud
Returns LocalCloud
Properties
optionalreadonlyargs
readonlycache
readonlychain
readonlydeveloper
readonlyid
readonlyisLocalCloud
readonlyjobId
readonlylocalWorker
Type declaration
Parameters
cloud: Cloud
Returns Promise<zkCloudWorker>
optionalreadonlymetadata
readonlyrepo
readonlystepId
optionalreadonlytask
readonlytaskId
optionalreadonlyuserId
Methods
publicaddTask
Adds a task to the local cloud
Parameters
data: { args?: string; metadata?: string; startTime?: number; task: string; userId?: string }
the data to use
Returns Promise<string>
the task id
publicdecrypt
Decrypts the data
Parameters
params: { context: string; data: string; keyId?: string }
Returns Promise<undefined | string>
publicdeleteTask
Deletes a task from the local cloud
Parameters
taskId: string
the task id to delete
Returns Promise<void>
publicdeleteTransaction
Deletes a transaction from the local cloud
Parameters
txId: string
the transaction id to delete
Returns Promise<void>
publicencrypt
Encrypts the data
Parameters
params: { context: string; data: string; keyId?: string }
Returns Promise<undefined | string>
encrypted data
publicexecute
Executes the task in the local cloud
Parameters
data: { args?: string; metadata?: string; task: string; transactions: string[]; userId?: string }
the data to use
Returns Promise<string>
the job id
forceWorkerRestart
forces the worker to restart
Returns Promise<void>
publicgetDataByKey
Gets the data by key
Parameters
key: string
the key to get the data
Returns Promise<undefined | string>
the data
publicgetDeployer
Provides the deployer key pair for testing and development
Returns Promise<undefined | DeployerKeyPair>
the deployer key pair
publicgetTransactions
Abstract method to get the transactions Used to get the transactions
Returns Promise<CloudTransaction[]>
the transactions
publicjobResult
Gets the job result
Parameters
jobId: string
the job id
Returns Promise<undefined | JobData>
the job data
publicloadFile
Loads the file
Parameters
filename: string
Returns Promise<undefined | Buffer>
the file data
publicprocessTasks
Processes the tasks in the local cloud
Returns Promise<void>
publicpublishTransactionMetadata
Publish the transaction metadata in human-readable format
Parameters
params: { metadata: TransactionMetadata; txId: string }
Returns Promise<void>
publicrecursiveProof
Runs the recursive proof in the local cloud
Parameters
data: { args?: string; metadata?: string; task?: string; transactions: string[]; userId?: string }
the data to use
Returns Promise<string>
the job id
publicreleaseDeployer
Releases the deployer key pair
Parameters
params: { publicKey: string; txsHashes: string[] }
Returns Promise<void>
publicsaveDataByKey
Saves the data by key
Parameters
key: string
the key to save the data
value: undefined | string
the value to save
Returns Promise<void>
publicsaveFile
Saves the file
Parameters
filename: string
the filename to save
value: Buffer
the value to save
Returns Promise<void>
publicsendTransactions
Send transactions to the local cloud
Parameters
transactions: string[]
the transactions to add
Returns Promise<CloudTransaction[]>
the transaction ids
publicstaticaddTransactions
Adds transactions to the local cloud
Parameters
transactions: string[] | CloudTransaction[]
the transactions to add
Returns Promise<CloudTransaction[]>
the transaction ids
staticprocessLocalTasks
Processes the local tasks
Parameters
params: { chain: blockchain; developer: string; localWorker: (cloud: Cloud) => Promise<zkCloudWorker>; repo: string }
the parameters to process the local tasks
Returns Promise<number>
publicstaticrun
Runs the worker in the local cloud
Parameters
params: { chain: blockchain; command: ApiCommand; data: { args?: string; developer: string; metadata?: string; repo: string; task: string; transactions: string[]; userId?: string }; localWorker: (cloud: Cloud) => Promise<zkCloudWorker> }
the parameters to run the worker
Returns Promise<string>
the job id
staticsequencer
Runs the sequencer in the local cloud
Parameters
params: { data: { args?: string; developer: string; metadata?: string; repo: string; task?: string; transactions: string[]; userId?: string }; worker: zkCloudWorker }
the parameters to run the sequencer
Returns Promise<string>
the proof
LocalCloud is a cloud that runs on the local machine for testing and development It uses LocalStorage to store jobs, tasks, transactions, and data It uses a localWorker to execute the tasks It can be used to test the cloud functionality without deploying to the cloud
the worker to execute the tasks