diff --git a/Docs/GenerateImplementation.md b/Docs/GenerateImplementation.md deleted file mode 100644 index 01c701f..0000000 --- a/Docs/GenerateImplementation.md +++ /dev/null @@ -1,116 +0,0 @@ -# Generate Module -P2PRC is a great layer of abstraction. This means that in many cases it is not an end product but rather -a tool that customized as an end product. An example would be writing your own billing module to monetize -the computation power available. The generate module copies the current with the appropriate git histories -and keeps only the go files which would be useful to edit. To use the generate module the user will need -to have a go compiler present in his computer. Due to the introduction of this module there will 2 releases: - -- Regular Release (Consists of only the build binary and cli command cannot access the generate module) -- Developer Release (Consists of important Go files and the cli can access the generate module) - -## How does this work ? - -### [Struct information](https://github.com/Akilan1999/p2p-rendering-computation/blob/9d69aed8ce0fe5273aaff2828f7d51c3d5ac2ce4/generate/generate.go#L19) -- ### ```Generate.go```: -This file creates a local copy of P2PRC from where the CLI was called from. -This go file also does various stuff like instruction of file should be ignored when copying and -which of should not be. Now let's understand this. Below is a sample code which does the following: - -```go - //---------------------------------------------------------------- - // Action performed: - // - Ensuring main.go file exists - // - Skipping all .go files apart from the ones listed above - // - Skipping .idea/ directory - // - Skipping Makefile file - //---------------------------------------------------------------- - Options.Skip = func(src string) (bool, error) { - switch { - case strings.HasSuffix(src, "main.go"): - return false, nil - case strings.HasSuffix(src, ".go"): - return true, nil - case strings.HasSuffix(src, ".idea"): - return true, nil - case strings.HasSuffix(src, "Makefile"): - return true, nil - default: - return false, nil - } - } - - // Doing the copy - err = copy.Copy("", "", Options) -``` - -Unfortunately currently this will have to be manually edited in the ```Generate.go``` file. When using the generate -module the user also creates their own Go module which is the modified version of P2PRC. This means -if the 1 modified package is using another modified package then the appropriate import have to be modified -in the file where the import is called: - -Ex: -```go - //Sample Project module name = Test - //Package names: - //- Test/Genius - //- Test/GeGeGenuis - // - // When we call the generate function with the new project with the module name = MicDrop - // The new package name would be: - // - MicDrop/Genius - // - MicDrop/GeGeGenuis - - // Test/Genius code depends on the package Test/GeGeGenuis - import ( - "Test/GeGeGenuis" - ) - -// When we create a new module with the copy of the -// existing project we need change: -import ( - "MicDrop/GeGeGenuis" -) -``` - -To do this we have built functions which can modify import names in the Go file provided. -To customize the use case of your generate module you would need to manually add your own -imports which are supposed to be replaced and in which files they are supposed to be replaced -in. - -```go -// 1.0 - Test/Genius.go -> GeGeGenuis module -// a is struct of type NewProject - a.FileNameAST = "/Test/Genius.go" - // Get AST information of the file - err := a.GetASTGoFile() - if err != nil { - return err - } - // Change the appropriate Go file - err = a.ChangeImports("Test/GeGeGenuis", "MicDrop/GeGeGenuis") - if err != nil { - return err - } - // Writes the change to the appropriate file - err = a.WriteGoAst() - if err != nil { - return err - } -``` - -Higher order of execution of ```Generate.go```: -1. Copy entire P2PRC project and ignores files which are not meant to be copied -2. The folder name will be based on the new project name and the module name based on the new - module name provided. -3. Modifies the appropriate imports in the project as instructed in the code. -4. Creates a commit with the new changes in the new project. - - -- ### ``` modifyGenerate.go```: - This a really simple implementation where we replace the imports - in certain files as instructed from ```generate.go```. To do we create an AST (i.e Abstract Syntax tree) - from new file we want to change the imports in. AST create a tree structure of expression. To change the - import we can just traverse to the appropriate expression and change the value of that expression in - the case of modifying imports. This approach is more simple than using templates. - - diff --git a/Docs/Installation.md b/Docs/Installation.md index 6028567..53a2427 100644 --- a/Docs/Installation.md +++ b/Docs/Installation.md @@ -2,8 +2,8 @@ Over here we will cover the basic steps to get the server and client side running. -## Alpha release install -https://github.com/Akilan1999/p2p-rendering-computation/releases/tag/v1.0.0-alpha +## Latest release install +https://github.com/Akilan1999/p2p-rendering-computation/releases ## Install from Github master branch @@ -65,7 +65,7 @@ USAGE: p2prc [global options] command [command options] [arguments...] VERSION: - 1.0.0 + COMMANDS: help, h Shows a list of commands or help for one command @@ -78,7 +78,7 @@ GLOBAL OPTIONS: --ViewImages value, --vi value View images available on the server IP address [$VIEW_IMAGES] --CreateVM value, --touch value Creates Docker container on the selected server [$CREATE_VM] --ContainerName value, --cn value Specifying the container run on the server side [$CONTAINER_NAME] - --RemoveVM value, --rm value Stop and Remove Docker container [$REMOVE_VM] + --RemoveVM value, --rm value Stop and Remove Docker container (IP:port) accompanied by container ID via --ID or --id [$REMOVE_VM] --ID value, --id value Docker Container ID [$ID] --Ports value, -p value Number of ports to open for the Docker Container [$NUM_PORTS] --GPU, --gpu Create Docker Containers to access GPU (default: false) [$USE_GPU] @@ -86,10 +86,20 @@ GLOBAL OPTIONS: --SetDefaultConfig, --dc Sets a default configuration file (default: false) [$SET_DEFAULT_CONFIG] --NetworkInterfaces, --ni Shows the network interface in your computer (default: false) [$NETWORK_INTERFACE] --ViewPlugins, --vp Shows plugins available to be executed (default: false) [$VIEW_PLUGIN] - --TrackedContainers, --tc View containers which have been created from the client side (default: false) [$TRACKED_CONTAINERS] + --TrackedContainers, --tc View (currently running) containers which have been created from the client side (default: false) [$TRACKED_CONTAINERS] --ExecutePlugin value, --plugin value Plugin which needs to be executed [$EXECUTE_PLUGIN] + --CreateGroup, --cgroup Creates a new group (default: false) [$CREATE_GROUP] + --Group value, --group value group flag with argument group ID [$GROUP] + --Groups, --groups View all groups (default: false) [$GROUPS] + --RemoveContainerGroup, --rmcgroup Remove specific container in the group (default: false) [$REMOVE_CONTAINER_GROUP] + --RemoveGroup value, --rmgroup value Removes the entire group [$REMOVE_GROUP] + --Generate value, --gen value Generates a new copy of P2PRC which can be modified based on your needs [$GENERATE] + --ModuleName value, --mod value New go project module name [$MODULENAME] + --PullPlugin value, --pp value Pulls plugin from git repos [$PULLPLUGIN] + --RemovePlugin value, --rp value Removes plugin [$REMOVEPLUGIN] --help, -h show help (default: false) --version, -v print the version (default: false) + ```
@@ -209,12 +219,6 @@ This feature is still Under Development: - Ansible: - Debian/ubuntu: ```sudo apt install ansible``` - Others: [Installation link](https://ansible-tips-and-tricks.readthedocs.io/en/latest/ansible/install/) - -#### Set ansible host_key_checking to false -- On linux - - ```sudo nano /etc/ansible/ansible.cfg```: Open the following file. If this file is not found then where - ever the file ```ansible.cfg``` is located. - - Add or uncomment ```host_key_checking = False``` #### Run Test Cases - Generate Test Case Ansible file diff --git a/Docs/P2P.md b/Docs/P2P.md index e6a33b3..875c1ea 100644 --- a/Docs/P2P.md +++ b/Docs/P2P.md @@ -19,10 +19,8 @@ In this repository the P2P module has been designed from sratch at the point of ## Responsibility -- To perform speed test to determine best node to connect - To ensure the IP table has nodes which are pingable -- Using techniques such as [UPNP](https://en.wikipedia.org/wiki/Universal_Plug_and_Play). Still under development -- Port Forwarding (To be introducted in a future release) +- Taking to nodes behind NAT. [More about the implementation](NAT-Traversal)... ## Note: diff --git a/Docs/P2PImplementation.md b/Docs/P2PImplementation.md index b73c713..1d92477 100644 --- a/Docs/P2PImplementation.md +++ b/Docs/P2PImplementation.md @@ -23,27 +23,12 @@ path of the IP table json file is received from the configuration module. "latency": "", "download": "", "upload": "" - "port no": "" + "port no": "", } ] } ``` -## Speed Test -The speed test functions populate the fields which are latency, download, upload speed. Before the -speed test begins for each server IP address. The p2p module ensures that each server IP address -is pingable. If the server IP address is not pingable then it removes that IP address from the struct. - ### Latency The latency is measured in milliseconds. The route /server_info is called from the server and time it takes to provide a json response is recorded. - -### Download speed -The download speed is measured as (/