Used for transfering a directory from one node to another.
A worker is an ephemeral process spawned by the sender and the receiver for the duration of the folder transfer.
Boot up 2 nodes, node.os and node2.os.
Let home and home2 be the home directories of the nodes, respectively.
cd folder_transfer
kit bs && kit s -p 8081
You will transfer a folder from node2.os to node.os.
Copy a folder you want to transfer into home2/vfs/folder_transfer:astronaut.os/send_from, so that it looks like home2/vfs/folder_transfer:astronaut.os/send_from/some_folder.
Then, in node.os terminal, run
m our@folder_transfer:folder_transfer:astronaut.os '{"RequestFolderAction": {"node_id": "sour-cabbage.os", "folder": "some_folder", "encrypt": false}}'
Now, in home/vfs/folder_transfer:astronaut.os/send_to you should find some_folder.
node.osfolder_transferprocess spawns a receiving worker, and initializes it withInitializeReceiverWorker.- Then it sends a download request to
node2.osfolder_transferprocess to receive the folder. node2.osfolder_transferprocess spawns a sending worker, and initializes it withInitializeSenderWorker.node2.osworkerprocess sends the folder tonode.osworkerprocess in chunks.- Once the transfer is done, each worker sends a
WorkerStatus::Doneto the process that spawned it, and then terminates.
To encrypt the data before sending, set the encrypt field to true.
In node.os terminal, run
m our@folder_transfer:folder_transfer:astronaut.os '{"RequestFolderAction": {"node_id": "sour-cabbage.os", "folder": "some_folder", "encrypt": true}}'
In home/vfs/folder_transfer:astronaut.os/send_to you should find a bunch of encrypted files.
Then the receiver has to decrypt the data.
In node.os terminal, run
m our@folder_transfer:folder_transfer:astronaut.os "DecryptFolder"
In home/vfs/folder_transfer:astronaut.os/decrypt_to you will find the decrypted files.