Skip to content
Snippets Groups Projects
Commit 86ceee09 authored by Xavier Perret's avatar Xavier Perret
Browse files

merged docs

parent 6873ed4e
Branches
No related tags found
1 merge request!2added file to separate client function from the server
# Distributed Systems # Distributed Systems
## Lab 1 ## Lab 1 - Deliverable 1.3
### Developing and deploying a broadcast algorithm for a blockchain management system on a Cloud infrastructure ### Developing and deploying a broadcast algorithm for a blockchain management system on a Cloud infrastructure
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
To launch the client you need to run the following command: To launch the client you need to run the following command:
```bash ```bash
go main.go --config=client_config.yaml --client go client.go --config=client_config.yaml
``` ```
Please note that the `client_config.yaml` can be a `neighbor-x.yaml` file if you want to create a transaction and spread Please note that the `client_config.yaml` can be a `neighbor-x.yaml` file if you want to create a transaction and spread
...@@ -27,19 +27,119 @@ it to neighbours instead on manually entering an ip. ...@@ -27,19 +27,119 @@ it to neighbours instead on manually entering an ip.
To lauch the server to which you wish to send commands using the client you need to do To lauch the server to which you wish to send commands using the client you need to do
```bash ```bash
go main.go --config=neighbor-0.yaml --server --root go server.go --config=neighbor-x.yaml --root
``` ```
#### Normal Server #### Normal Server
To launch the other server you need to run the following command: To launch the other server you need to run the following command:
```bash ```bash
go main.go --config=server_config.yaml --server go server.go --config=neighbor-x.yaml
``` ```
### Functionalities ### Functionalities
- Able to create a transaction from the client and then request to root server to broadcast by wave to all the other servers - Able to create a transaction from the client and then request to root server to broadcast by wave to all the other servers
- Able to send a rate request from client to root server then broadcast by wave to all the other servers (buggy at the moment) - Able to send a rate request from client to root server then broadcast by wave to all the other servers
- Not able to fake a transaction yet - Able to fake a transaction on a node by using its command line
- Able to print all local transaction from any server or client - Able to print all local transaction from any server or client on a node by using its command line
\ No newline at end of file
### Object Storage Module
#### Requirements
- Go 1.14
- Azure CLI
- Azure Storage Account configured (like <https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-go>)
- For testing you need to change the "hepiadistributedsystems" by the storage account name
```go
azureCreds := InitAzureCredentials("hepiadistributedsystems")
```
- Should not be necessary _Azure Storage Blob Sdk (The right version is already in `go.mod` dependencies)_
##### Project Description
- `test.go` : Contains the main function to launch the tests
- `object-storage/object-storage.go` : Contains the functions to interact with the object storage and the test function
- `types/datastructures.go` : Contains the datastructure useful for this lab (transactions, object storage, ...)
##### Methods Description
```go
func addTransactionToBlobStorage(transaction Transaction, database Database, os Blob) Database
```
Add transaction to given database and upload it to the blob storage. The database is then returned.
```go
func fakeTransaction(transactionToFake Transaction, fakeTransaction Transaction, database Database) Database
```
Find the given transaction to replace and replace it with the fake transaction. The database is then returned.
```go
func readDatabaseFromBlobStorage(blob Blob) Database
```
Read (Download) the database from the blob storage and return it.
```go
func readGivenBlobFromContainer(blob Blob, data any) any
```
Read given blob that is of type data from the container and return it.
```go
func writeDatabaseToBlobStorage(database Database, blob Blob)
```
Write given database to given blob/file.
```go
func writeGivenDataToBlob(blob Blob, data any)
```
Write given data to given blob/file.
```go
func InitAzureCredentials(storageAccountName string) AzureCredentials
```
Initialize the Azure credentials with the given storage account name.
```go
func InitializeBlobFromObjectStorageCreds(blobName string, azureCreds AzureCredentials) Blob
```
Initialize a container and then a blob/file (for upload/download) with the given blobName and returns it.
```go
func InitializeContainer(containerName string, azureCreds AzureCredentials) azblob.ContainerClient
```
Initialize a container with the given containerName and returns it (to create/delete/manage blob in it).
```go
func InitializeBlob(blobName string, azureCreds AzureCredentials, containerName string, containerClient azblob.ContainerClient) azblob.BlockBlobClient
```
Initialize a blob/file (for upload/download) with the given blobName and returns an object to interact with it (write/read data).
```go
func ListBlobs(blob Blob)
```
List blobs in container
```go
func PrintingDatabaseToConsole(database Database)
```
Print the database to the console.
```go
func TestObjectStorage()
```
Provide tests for the object storage.
# Distributed Systems
## Lab 1
### Developing and deploying a broadcast algorithm for a blockchain management system on a Cloud infrastructure
- Student : Xavier Perret
- Email : xavier.perret@etu.hesge.ch
- Group : 1
- WARNING : D#1.2 is on branch "vite" and not on master
- <ssh://git@ssh.hesge.ch:10572/xavier.perret/perso-distributed-systems.git>
- <https://gitedu.hesge.ch/xavier.perret/perso-distributed-systems.git>
- Deliverable D#1.2
### Requirements
- Go 1.14
- Azure CLI
- Azure Storage Account configured (like <https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-go>)
- For testing you need to change the "hepiadistributedsystems" by the storage account name
```go
azureCreds := InitAzureCredentials("hepiadistributedsystems")
```
- Should not be necessary _Azure Storage Blob Sdk (The right version is already in `go.mod` dependencies)_
### Project Description
- `test.go` : Contains the main function to launch the tests
- `object-storage/object-storage.go` : Contains the functions to interact with the object storage and the test function
- `types/datastructures.go` : Contains the datastructure useful for this lab (transactions, object storage, ...)
### Methods Description
```go
func addTransactionToBlobStorage(transaction Transaction, database Database, os Blob) Database
```
Add transaction to given database and upload it to the blob storage. The database is then returned.
```go
func fakeTransaction(transactionToFake Transaction, fakeTransaction Transaction, database Database) Database
```
Find the given transaction to replace and replace it with the fake transaction. The database is then returned.
```go
func readDatabaseFromBlobStorage(blob Blob) Database
```
Read (Download) the database from the blob storage and return it.
```go
func readGivenBlobFromContainer(blob Blob, data any) any
```
Read given blob that is of type data from the container and return it.
```go
func writeDatabaseToBlobStorage(database Database, blob Blob)
```
Write given database to given blob/file.
```go
func writeGivenDataToBlob(blob Blob, data any)
```
Write given data to given blob/file.
```go
func InitAzureCredentials(storageAccountName string) AzureCredentials
```
Initialize the Azure credentials with the given storage account name.
```go
func InitializeBlobFromObjectStorageCreds(blobName string, azureCreds AzureCredentials) Blob
```
Initialize a container and then a blob/file (for upload/download) with the given blobName and returns it.
```go
func InitializeContainer(containerName string, azureCreds AzureCredentials) azblob.ContainerClient
```
Initialize a container with the given containerName and returns it (to create/delete/manage blob in it).
```go
func InitializeBlob(blobName string, azureCreds AzureCredentials, containerName string, containerClient azblob.ContainerClient) azblob.BlockBlobClient
```
Initialize a blob/file (for upload/download) with the given blobName and returns an object to interact with it (write/read data).
```go
func ListBlobs(blob Blob)
```
List blobs in container
```go
func PrintingDatabaseToConsole(database Database)
```
Print the database to the console.
```go
func TestObjectStorage()
```
Provide tests for the object storage.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment