From 86ceee099dfd10c3e746123cb038ad0c3c82ea5e Mon Sep 17 00:00:00 2001 From: Xavier Perret <xa.perret@outlook.com> Date: Fri, 28 Oct 2022 12:00:26 +0200 Subject: [PATCH] merged docs --- README.md | 114 ++++++++++++++++++++++++++++++++++++++++++++++--- readme-lab1.md | 111 ----------------------------------------------- 2 files changed, 107 insertions(+), 118 deletions(-) delete mode 100644 readme-lab1.md diff --git a/README.md b/README.md index 9c76c49..ccc326f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Distributed Systems -## Lab 1 +## Lab 1 - Deliverable 1.3 ### Developing and deploying a broadcast algorithm for a blockchain management system on a Cloud infrastructure @@ -15,7 +15,7 @@ To launch the client you need to run the following command: ```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 @@ -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 ```bash -go main.go --config=neighbor-0.yaml --server --root +go server.go --config=neighbor-x.yaml --root ``` #### Normal Server To launch the other server you need to run the following command: ```bash -go main.go --config=server_config.yaml --server +go server.go --config=neighbor-x.yaml ``` ### 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 send a rate request from client to root server then broadcast by wave to all the other servers (buggy at the moment) -- Not able to fake a transaction yet -- Able to print all local transaction from any server or client \ No newline at end of file +- Able to send a rate request from client to root server then broadcast by wave to all the other servers +- Able to fake a transaction on a node by using its command line +- Able to print all local transaction from any server or client on a node by using its command line + +### 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. + diff --git a/readme-lab1.md b/readme-lab1.md deleted file mode 100644 index 7d6b2df..0000000 --- a/readme-lab1.md +++ /dev/null @@ -1,111 +0,0 @@ -# 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. - -- GitLab