updated docs

This commit is contained in:
2023-06-08 03:39:05 +01:00
parent 5ac033403f
commit 4d2b903a0f
6 changed files with 20 additions and 184 deletions

View File

@@ -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("<P2PRC folder you want to copy from>", "<PATH to the directory>", 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 = "<path to project to copy from>/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.

View File

@@ -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
<version no>
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)
```
<br>
@@ -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

View File

@@ -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:

View File

@@ -23,27 +23,12 @@ path of the IP table json file is received from the configuration module.
"latency": "<latency>",
"download": "<download>",
"upload": "<upload>"
"port no": "<server port no>"
"port no": "<server 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 (<file size>/<time taken to
download>)*8. This gives the result in megabits per second. The file downloaded is a 50 mb
auto generated file.
### Upload speed
The upload speed is measured as (<file size>/<time taken to upload>)*8. This
gives the results in megabits per second. The file uploaded is a 50 mb auto generated file.
The route /upload is called from the server side to upload the file.

View File

@@ -1,35 +0,0 @@
# Problems in implementation
### Number of Devices in the network:
The current implementation has the major flaw which is that
the server has to be in port 8088 to detected in the public
network. As we know most personal networks have a single IP
address. This means we cannot have duplicate ports. A fix can
be to mention the open port on the IP table file.
(Ex: Possible feild to be added)
```
{
"ip_address": [
{
"ipv4": "localhost",
"latency": 14981051,
"download": 8142.122540206258,
"upload": 3578.766512629995,
"port": 8088
}
]
}
```
### Broadcast of container specs
At the moment the container specs are not broadcasted rather
just the machines specs and this module has yet to be tested
rigorously.
### Intergration with GPU
Certain machines have GPUs present in them which provide a
huge advantage for those who want to do rendering and certain
sort of computation. The Aim is to only allow it to be compatible
with Nvidia. But an better idea would be to provide compatability
with multiple GPU providers.

View File

@@ -3,10 +3,10 @@
1. [Introduction](Introduction.md)
2. [Installation](Installation.md)
3. [Abstractions](Abstractions.md)
3. [Design Architecture](DesignArchtectureIntro.md)
<!-- 3. [Design Architecture](DesignArchtectureIntro.md)
1. [Client Module](ClientArchitecture.md)
2. [P2P Module](P2PArchitecture.md)
3. [Server Module](ServerArchitecture.md)
3. [Server Module](ServerArchitecture.md) -->
4. [Implementation](Implementation.md)
1. [Client Module](ClientImplementation.md)
2. [P2P Module](P2PImplementation.md)
@@ -14,5 +14,5 @@
4. [Config Module](ConfigImplementation.md)
5. [Cli Module](CliImplementation.md)
6. [Plugin Module](PluginImplementation.md)
5. [Problems](https://github.com/Akilan1999/p2p-rendering-computation/issues)
<!-- 5. [Problems](https://github.com/Akilan1999/p2p-rendering-computation/issues) -->