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

function to add transactions works !

parent 24045816
No related branches found
No related tags found
1 merge request!2added file to separate client function from the server
......@@ -2,7 +2,6 @@ package object_storage
import (
"bufio"
"bytes"
"context"
"encoding/json"
"fmt"
......@@ -126,8 +125,8 @@ func InitializeObjectStorage(baseObjectStorageName string, azureCreds AzureCrede
}
func TestObjectStorage() {
ctx := context.Background()
// url := "https://hepiadistributedsystems.blob.core.windows.net/" //replace <StorageAccountName> with your Azure storage account name
azureCreds := InitAzureCredentials("hepiadistributedsystems")
blobName := "quickstartblob" + "-" + randomString()
objectStorage := InitializeObjectStorage(blobName, azureCreds)
......@@ -145,10 +144,11 @@ func TestObjectStorage() {
Receiver: "1",
Amount: "1000",
}
db = addTransactionToBlobStorage(t1, db)
db = addTransactionToBlobStorage(t2, db)
db = addTransactionToBlobStorage(t1, db, objectStorage)
db = addTransactionToBlobStorage(t2, db, objectStorage)
// List the blobs in the container
/*
fmt.Println("Listing the blobs in the container:")
pager := containerClient.ListBlobsFlat(nil)
......@@ -184,6 +184,7 @@ func TestObjectStorage() {
fmt.Println(downloadedData.String())
*/
fmt.Printf("Press enter key to delete the blob fils, example container, and exit the application.\n")
bufio.NewReader(os.Stdin).ReadBytes('\n')
fmt.Printf("Cleaning up.\n")
......@@ -191,14 +192,14 @@ func TestObjectStorage() {
// Delete the blob
fmt.Printf("Deleting the blob " + blobName + "\n")
_, err = blobClient.Delete(ctx, nil)
_, err := objectStorage.BlockBlobClient.Delete(ctx, nil)
if err != nil {
log.Fatalf("Failure: %+v", err)
}
// Delete the container
fmt.Printf("Deleting the blob " + containerName + "\n")
_, err = containerClient.Delete(ctx, nil)
fmt.Printf("Deleting the blob " + objectStorage.ContainerName + "\n")
_, err = objectStorage.ContainerClient.Delete(ctx, nil)
if err != nil {
log.Fatalf("Failure: %+v", err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment