Skip to content

Commit

Permalink
Create edge_storage.go
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH committed Jun 25, 2024
1 parent f53d412 commit 8375d10
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions storage/edge_storage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// storage/edge_storage.go
package main

import (
"context"
"fmt"
"log"

edge "github.com/edgelesssys/edge"
)

type EdgeStorage struct {
edgeClient *edge.Client
}

func NewEdgeStorage() *EdgeStorage {
edgeClient, err := edge.NewClient(context.Background())
if err!= nil {
log.Fatal(err)
}
return &EdgeStorage{edgeClient: edgeClient}
}

func (es *EdgeStorage) StoreData(data []byte) error {
// Store data on edge devices using the Edgeless library
return es.edgeClient.Put(context.Background(), "data", data)
}

func (es *EdgeStorage) RetrieveData() ([]byte, error) {
// Retrieve data from edgedevices using the Edgeless library
return es.edgeClient.Get(context.Background(), "data")
}

0 comments on commit 8375d10

Please sign in to comment.