Skip to content

Commit

Permalink
added FindBestAndTargetInLogs
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan6sha committed Apr 4, 2024
1 parent b9f47bb commit 4119a82
Show file tree
Hide file tree
Showing 7 changed files with 196 additions and 42 deletions.
5 changes: 4 additions & 1 deletion blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ func (bl *FxBlockchain) serve(w http.ResponseWriter, r *http.Request) {
actionFetchContainerLogs: func(from peer.ID, w http.ResponseWriter, r *http.Request) {
bl.handleFetchContainerLogs(r.Context(), from, w, r)
},
actionFindBestAndTargetInLogs: func(from peer.ID, w http.ResponseWriter, r *http.Request) {
bl.handleFindBestAndTargetInLogs(r.Context(), from, w, r)
},
actionGetFolderSize: func(from peer.ID, w http.ResponseWriter, r *http.Request) {
bl.handleGetFolderSize(r.Context(), from, w, r)
},
Expand Down Expand Up @@ -870,7 +873,7 @@ func (bl *FxBlockchain) authorized(pid peer.ID, action string) bool {
switch action {
case actionReplicateInPool:
return (bl.authorizer == bl.h.ID() || bl.authorizer == "")
case actionBloxFreeSpace, actionAccountFund, actionManifestBatchUpload, actionAssetsBalance, actionGetDatastoreSize, actionGetFolderSize, actionFetchContainerLogs, actionEraseBlData, actionWifiRemoveall, actionReboot, actionPartition, actionDeleteWifi, actionDisconnectWifi, actionDeleteFulaConfig, actionGetAccount, actionSeeded, actionAccountExists, actionPoolCreate, actionPoolJoin, actionPoolCancelJoin, actionPoolRequests, actionPoolList, actionPoolVote, actionPoolLeave, actionManifestUpload, actionManifestStore, actionManifestAvailable, actionManifestRemove, actionManifestRemoveStorer, actionManifestRemoveStored, actionTransferToMumbai:
case actionBloxFreeSpace, actionAccountFund, actionManifestBatchUpload, actionAssetsBalance, actionGetDatastoreSize, actionGetFolderSize, actionFindBestAndTargetInLogs, actionFetchContainerLogs, actionEraseBlData, actionWifiRemoveall, actionReboot, actionPartition, actionDeleteWifi, actionDisconnectWifi, actionDeleteFulaConfig, actionGetAccount, actionSeeded, actionAccountExists, actionPoolCreate, actionPoolJoin, actionPoolCancelJoin, actionPoolRequests, actionPoolList, actionPoolVote, actionPoolLeave, actionManifestUpload, actionManifestStore, actionManifestAvailable, actionManifestRemove, actionManifestRemoveStorer, actionManifestRemoveStored, actionTransferToMumbai:
bl.authorizedPeersLock.RLock()
_, ok := bl.authorizedPeers[pid]
bl.authorizedPeersLock.RUnlock()
Expand Down
78 changes: 78 additions & 0 deletions blockchain/blox.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,43 @@ func (bl *FxBlockchain) FetchContainerLogs(ctx context.Context, to peer.ID, r wi
}
}

func (bl *FxBlockchain) FindBestAndTargetInLogs(ctx context.Context, to peer.ID, r wifi.FindBestAndTargetInLogsRequest) ([]byte, error) {

if bl.allowTransientConnection {
ctx = network.WithUseTransient(ctx, "fx.blockchain")
}

var buf bytes.Buffer
if err := json.NewEncoder(&buf).Encode(r); err != nil {
return nil, err
}

req, err := http.NewRequestWithContext(ctx, http.MethodGet, "http://"+to.String()+".invalid/"+actionFindBestAndTargetInLogs, &buf)
if err != nil {
return nil, err
}
resp, err := bl.c.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
b, err := io.ReadAll(resp.Body)
switch {
case err != nil:
return nil, err
case resp.StatusCode != http.StatusAccepted:
// Attempt to parse the body as JSON.
if jsonErr := json.Unmarshal(b, &apiError); jsonErr != nil {
// If we can't parse the JSON, return the original body in the error.
return nil, fmt.Errorf("unexpected response: %d %s", resp.StatusCode, string(b))
}
// Return the parsed error message and description.
return nil, fmt.Errorf("unexpected response: %d %s - %s", resp.StatusCode, apiError.Message, apiError.Description)
default:
return b, nil
}
}

func (bl *FxBlockchain) GetFolderSize(ctx context.Context, to peer.ID, r wifi.GetFolderSizeRequest) ([]byte, error) {

if bl.allowTransientConnection {
Expand Down Expand Up @@ -431,6 +468,47 @@ func (bl *FxBlockchain) handleFetchContainerLogs(ctx context.Context, from peer.

}

func (bl *FxBlockchain) handleFindBestAndTargetInLogs(ctx context.Context, from peer.ID, w http.ResponseWriter, r *http.Request) {
log := log.With("action", actionFindBestAndTargetInLogs, "from", from)

// Parse the JSON body of the request into the DeleteWifiRequest struct
var req wifi.FindBestAndTargetInLogsRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
log.Error("failed to decode request: %v", err)
http.Error(w, "failed to decode request", http.StatusBadRequest)
return
}
log.Debugw("handleFindBestAndTargetInLogs received", "req", req)

out := wifi.FindBestAndTargetInLogsResponse{

Check failure on line 483 in blockchain/blox.go

View workflow job for this annotation

GitHub Actions / All

this value of out is never used (SA4006)

Check failure on line 483 in blockchain/blox.go

View workflow job for this annotation

GitHub Actions / All

this value of out is never used (SA4006)
Best: "0",
Target: "0",
Err: "",
}
best, target, err := wifi.FindBestAndTargetInLogs(ctx, req)
if err != nil {
out = wifi.FindBestAndTargetInLogsResponse{
Best: "0",
Target: "0",
Err: err.Error(),
}
} else {
out = wifi.FindBestAndTargetInLogsResponse{
Best: best,
Target: target,
Err: "",
}
}
log.Debugw("handleFindBestAndTargetInLogs response", "out", out)
w.WriteHeader(http.StatusAccepted)
if err := json.NewEncoder(w).Encode(out); err != nil {
log.Error("failed to write response: %v", err)
http.Error(w, "failed to write response", http.StatusInternalServerError)
return
}

}

func (bl *FxBlockchain) handleGetFolderSize(ctx context.Context, from peer.ID, w http.ResponseWriter, r *http.Request) {
log := log.With("action", actionGetFolderSize, "from", from)

Expand Down
76 changes: 40 additions & 36 deletions blockchain/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,19 @@ const (
actionManifestAvailableAllaccountsBatch = "fula-manifest-available_allaccounts_batch"

//Hardware
actionBloxFreeSpace = "blox-free-space"
actionEraseBlData = "erase-blockchain-data"
actionWifiRemoveall = "wifi-removeall"
actionReboot = "reboot"
actionPartition = "partition"
actionDeleteFulaConfig = "delete-fula-config"
actionDeleteWifi = "delete-wifi"
actionDisconnectWifi = "disconnect-wifi"
actionGetAccount = "get-account"
actionFetchContainerLogs = "fetch-container-logs"
actionGetFolderSize = "get-folder-size"
actionGetDatastoreSize = "get-datastore-size"
actionBloxFreeSpace = "blox-free-space"
actionEraseBlData = "erase-blockchain-data"
actionWifiRemoveall = "wifi-removeall"
actionReboot = "reboot"
actionPartition = "partition"
actionDeleteFulaConfig = "delete-fula-config"
actionDeleteWifi = "delete-wifi"
actionDisconnectWifi = "disconnect-wifi"
actionGetAccount = "get-account"
actionFetchContainerLogs = "fetch-container-logs"
actionFindBestAndTargetInLogs = "find-bestandtarget-inlogs"
actionGetFolderSize = "get-folder-size"
actionGetDatastoreSize = "get-datastore-size"

// Cluster
actionReplicateInPool = "replicate"
Expand Down Expand Up @@ -422,6 +423,7 @@ type Blockchain interface {
DeleteFulaConfig(context.Context, peer.ID) ([]byte, error)
GetAccount(context.Context, peer.ID) ([]byte, error)
FetchContainerLogs(context.Context, peer.ID, wifi.FetchContainerLogsRequest) ([]byte, error)
FindBestAndTargetInLogs(context.Context, peer.ID, wifi.FindBestAndTargetInLogsRequest) ([]byte, error)
GetFolderSize(context.Context, peer.ID, wifi.GetFolderSizeRequest) ([]byte, error)
GetDatastoreSize(context.Context, peer.ID, wifi.GetDatastoreSizeRequest) ([]byte, error)
}
Expand Down Expand Up @@ -455,18 +457,19 @@ var requestTypes = map[string]reflect.Type{
actionReplicateInPool: reflect.TypeOf(ReplicateRequest{}),

//Hardware
actionBloxFreeSpace: reflect.TypeOf(wifi.BloxFreeSpaceRequest{}),
actionEraseBlData: reflect.TypeOf(wifi.EraseBlDataRequest{}),
actionWifiRemoveall: reflect.TypeOf(wifi.WifiRemoveallRequest{}),
actionReboot: reflect.TypeOf(wifi.RebootRequest{}),
actionPartition: reflect.TypeOf(wifi.PartitionRequest{}),
actionDeleteFulaConfig: reflect.TypeOf(wifi.DeleteFulaConfigRequest{}),
actionDeleteWifi: reflect.TypeOf(wifi.DeleteWifiRequest{}),
actionDisconnectWifi: reflect.TypeOf(wifi.DeleteWifiRequest{}),
actionGetAccount: reflect.TypeOf(GetAccountRequest{}),
actionFetchContainerLogs: reflect.TypeOf(wifi.FetchContainerLogsRequest{}),
actionGetFolderSize: reflect.TypeOf(wifi.GetFolderSizeRequest{}),
actionGetDatastoreSize: reflect.TypeOf(wifi.GetDatastoreSizeRequest{}),
actionBloxFreeSpace: reflect.TypeOf(wifi.BloxFreeSpaceRequest{}),
actionEraseBlData: reflect.TypeOf(wifi.EraseBlDataRequest{}),
actionWifiRemoveall: reflect.TypeOf(wifi.WifiRemoveallRequest{}),
actionReboot: reflect.TypeOf(wifi.RebootRequest{}),
actionPartition: reflect.TypeOf(wifi.PartitionRequest{}),
actionDeleteFulaConfig: reflect.TypeOf(wifi.DeleteFulaConfigRequest{}),
actionDeleteWifi: reflect.TypeOf(wifi.DeleteWifiRequest{}),
actionDisconnectWifi: reflect.TypeOf(wifi.DeleteWifiRequest{}),
actionGetAccount: reflect.TypeOf(GetAccountRequest{}),
actionFetchContainerLogs: reflect.TypeOf(wifi.FetchContainerLogsRequest{}),
actionFindBestAndTargetInLogs: reflect.TypeOf(wifi.FindBestAndTargetInLogsRequest{}),
actionGetFolderSize: reflect.TypeOf(wifi.GetFolderSizeRequest{}),
actionGetDatastoreSize: reflect.TypeOf(wifi.GetDatastoreSizeRequest{}),
}

var responseTypes = map[string]reflect.Type{
Expand Down Expand Up @@ -498,16 +501,17 @@ var responseTypes = map[string]reflect.Type{
actionReplicateInPool: reflect.TypeOf(ReplicateResponse{}),

//Hardware
actionBloxFreeSpace: reflect.TypeOf(wifi.BloxFreeSpaceResponse{}),
actionEraseBlData: reflect.TypeOf(wifi.EraseBlDataResponse{}),
actionWifiRemoveall: reflect.TypeOf(wifi.WifiRemoveallResponse{}),
actionReboot: reflect.TypeOf(wifi.RebootResponse{}),
actionPartition: reflect.TypeOf(wifi.PartitionResponse{}),
actionDeleteFulaConfig: reflect.TypeOf(wifi.DeleteFulaConfigResponse{}),
actionDeleteWifi: reflect.TypeOf(wifi.DeleteWifiResponse{}),
actionDisconnectWifi: reflect.TypeOf(wifi.DeleteWifiResponse{}),
actionGetAccount: reflect.TypeOf(GetAccountResponse{}),
actionFetchContainerLogs: reflect.TypeOf(wifi.FetchContainerLogsResponse{}),
actionGetFolderSize: reflect.TypeOf(wifi.GetFolderSizeResponse{}),
actionGetDatastoreSize: reflect.TypeOf(wifi.GetDatastoreSizeResponse{}),
actionBloxFreeSpace: reflect.TypeOf(wifi.BloxFreeSpaceResponse{}),
actionEraseBlData: reflect.TypeOf(wifi.EraseBlDataResponse{}),
actionWifiRemoveall: reflect.TypeOf(wifi.WifiRemoveallResponse{}),
actionReboot: reflect.TypeOf(wifi.RebootResponse{}),
actionPartition: reflect.TypeOf(wifi.PartitionResponse{}),
actionDeleteFulaConfig: reflect.TypeOf(wifi.DeleteFulaConfigResponse{}),
actionDeleteWifi: reflect.TypeOf(wifi.DeleteWifiResponse{}),
actionDisconnectWifi: reflect.TypeOf(wifi.DeleteWifiResponse{}),
actionGetAccount: reflect.TypeOf(GetAccountResponse{}),
actionFetchContainerLogs: reflect.TypeOf(wifi.FetchContainerLogsResponse{}),
actionFindBestAndTargetInLogs: reflect.TypeOf(wifi.FindBestAndTargetInLogsResponse{}),
actionGetFolderSize: reflect.TypeOf(wifi.GetFolderSizeResponse{}),
actionGetDatastoreSize: reflect.TypeOf(wifi.GetDatastoreSizeResponse{}),
}
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ require (
github.com/tyler-smith/go-bip39 v1.1.0
github.com/urfave/cli/v2 v2.27.1
go.uber.org/ratelimit v0.3.0
golang.org/x/crypto v0.19.0
golang.org/x/crypto v0.21.0
golang.org/x/sync v0.6.0
gopkg.in/ini.v1 v1.67.0
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -49,7 +49,7 @@ require (
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/sys v0.18.0 // indirect
gotest.tools/v3 v3.4.0 // indirect
)

Expand Down Expand Up @@ -268,11 +268,12 @@ require (
go.uber.org/zap v1.26.0 // indirect
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/mobile v0.0.0-20240320162201-c76e57eead38 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.18.0 // indirect
golang.org/x/tools v0.19.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gonum.org/v1/gonum v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
Expand Down
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,8 @@ golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98y
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -1181,6 +1183,8 @@ golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPI
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mobile v0.0.0-20240320162201-c76e57eead38 h1:Pje51YXhl8Griu25k5zJBD48T4C0qA7YUd5myQfnFLo=
golang.org/x/mobile v0.0.0-20240320162201-c76e57eead38/go.mod h1:DN+F2TpepQEh5goqWnM3gopfFakSWM8OmHiz0rPRjT4=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
Expand All @@ -1192,6 +1196,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -1250,6 +1256,8 @@ golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down Expand Up @@ -1362,6 +1370,8 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down Expand Up @@ -1453,6 +1463,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ=
golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg=
golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw=
golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
7 changes: 7 additions & 0 deletions mobile/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@ func (c *Client) FetchContainerLogs(ContainerName string, TailCount string) ([]b
return c.bl.FetchContainerLogs(ctx, c.bloxPid, wifi.FetchContainerLogsRequest{ContainerName: ContainerName, TailCount: TailCount})
}

// GetAccount requests blox at Config.BloxAddr to get the balance of the account.
// the addr must be a valid multiaddr that includes peer ID.
func (c *Client) FindBestAndTargetInLogs(NodeContainerName string, TailCount string) ([]byte, error) {
ctx := context.TODO()
return c.bl.FindBestAndTargetInLogs(ctx, c.bloxPid, wifi.FindBestAndTargetInLogsRequest{NodeContainerName: NodeContainerName, TailCount: TailCount})
}

// GetAccount requests blox at Config.BloxAddr to get the balance of the account.
// the addr must be a valid multiaddr that includes peer ID.
func (c *Client) GetFolderSize(folderPath string) ([]byte, error) {
Expand Down
Loading

0 comments on commit 4119a82

Please sign in to comment.