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
optionalcache: string
the cache folder
chain: blockchain
the blockchain to execute the job on, can be any blockchain, not only local
job: JobData
the job data
localWorker: (cloud: Cloud) => Promise<zkCloudWorker>
the worker to execute the tasks
optionalstepId: string
the step id
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
optionalargs: string
the arguments for the job
optionalmetadata: string
the metadata for the job
optionalstartTime: number
the start time for the task
task: string
the task to execute
optionaluserId: string
the user id
Returns Promise<string>
the task id
publicdecrypt
Decrypts the data
Parameters
params: { context: string; data: string; keyId?: string }
context: string
the context
data: string
the data
optionalkeyId: string
the key id, optional
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 }
context: string
the context
data: string
the data
optionalkeyId: string
the key id, optional
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
optionalargs: string
the arguments for the job
optionalmetadata: string
the metadata for the job
task: string
the task to execute
transactions: string[]
the transactions to process
optionaluserId: string
the user id
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 }
metadata: TransactionMetadata
the metadata
txId: string
the transaction id
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
optionalargs: string
the arguments for the job
optionalmetadata: string
the metadata for the job
optionaltask: string
the task to execute
transactions: string[]
the transactions to process
optionaluserId: string
the user id
Returns Promise<string>
the job id
publicreleaseDeployer
Releases the deployer key pair
Parameters
params: { publicKey: string; txsHashes: string[] }
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
chain: blockchain
the blockchain to execute the job on
developer: string
the developer of the repo
localWorker: (cloud: Cloud) => Promise<zkCloudWorker>
the worker to execute the tasks
repo: string
the repo
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
chain: blockchain
the blockchain to execute the job on
command: ApiCommand
the command to run
data: { args?: string; developer: string; metadata?: string; repo: string; task: string; transactions: string[]; userId?: string }
the data to use
localWorker: (cloud: Cloud) => Promise<zkCloudWorker>
the worker to execute the tasks
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
data: { args?: string; developer: string; metadata?: string; repo: string; task?: string; transactions: string[]; userId?: string }
the data to use
worker: zkCloudWorker
the worker to execute the tasks
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