Distributed Systems
Lab 1 - Deliverable 1.3
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
- ssh://git@ssh.hesge.ch:10572/xavier.perret/perso-distributed-systems.git
- https://gitedu.hesge.ch/xavier.perret/perso-distributed-systems.git
Client
To launch the client you need to run the following command:
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
it to neighbours instead on manually entering an ip.
Server
Root Server
To lauch the server to which you wish to send commands using the client you need to do
go server.go --config=neighbor-x.yaml --root
Normal Server
To launch the other server you need to run the following command:
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
- 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
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
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.
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.
func readDatabaseFromBlobStorage(blob Blob) Database
Read (Download) the database from the blob storage and return it.
func readGivenBlobFromContainer(blob Blob, data any) any
Read given blob that is of type data from the container and return it.
func writeDatabaseToBlobStorage(database Database, blob Blob)
Write given database to given blob/file.
func writeGivenDataToBlob(blob Blob, data any)
Write given data to given blob/file.
func InitAzureCredentials(storageAccountName string) AzureCredentials
Initialize the Azure credentials with the given storage account name.
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.
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).
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).
func ListBlobs(blob Blob)
List blobs in container
func PrintingDatabaseToConsole(database Database)
Print the database to the console.
func TestObjectStorage()
Provide tests for the object storage.