-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: stone node sends piece data to gateway #128
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
685eeaf
feat: stone node sends piece data to gateway
yzhaoyu bc31299
feat: alloc resp add bucket name and object name
yzhaoyu cfbc50d
Merge branch 'develop' into syncer_to_gateway
yzhaoyu 20582f6
fix: fix errors of stone node uint test
yzhaoyu a579c7b
fix: fix gateway config
yzhaoyu 4bf940c
fix: add gateway syncer rpc ut
yzhaoyu 83d4edc
fix: add one log in gateway sync piece handler func
yzhaoyu c610ba5
Merge branch 'develop' into syncer_to_gateway
yzhaoyu 845cc91
fix: add detailed log in gateway sync piece handler
yzhaoyu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,8 +60,6 @@ message PieceJob { | |
StorageProviderSealInfo storage_provider_seal_info = 8; | ||
} | ||
|
||
|
||
|
||
message StoneHubServiceBeginUploadPayloadV2Request { | ||
string trace_id = 1; | ||
// bytes tx_hash = 2; | ||
|
@@ -95,8 +93,10 @@ message StoneHubServiceAllocStoneJobRequest { | |
message StoneHubServiceAllocStoneJobResponse { | ||
string trace_id = 1; | ||
// bytes tx_hash = 2; | ||
PieceJob piece_job = 3; | ||
ErrMessage err_message = 4; | ||
string bucket_name = 3; | ||
string object_name = 4; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add the field of pb between stone hub and stone node. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
PieceJob piece_job = 5; | ||
ErrMessage err_message = 6; | ||
} | ||
|
||
message StoneHubServiceDoneSecondaryPieceJobRequest { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package gateway | ||
|
||
import ( | ||
"context" | ||
"encoding/base64" | ||
"testing" | ||
|
||
"github.com/bnb-chain/greenfield-storage-provider/model" | ||
"google.golang.org/grpc" | ||
|
||
stypes "github.com/bnb-chain/greenfield-storage-provider/service/types/v1" | ||
) | ||
|
||
func setup(t *testing.T) *Gateway { | ||
return &Gateway{ | ||
config: &GatewayConfig{ | ||
StorageProvider: "test1", | ||
Address: "test2", | ||
Domain: "test3", | ||
UploaderServiceAddress: "test4", | ||
DownloaderServiceAddress: "test5", | ||
ChallengeServiceAddress: "test6", | ||
SyncerServiceAddress: "test7", | ||
ChainConfig: DefaultChainClientConfig, | ||
}, | ||
name: model.GatewayService, | ||
} | ||
} | ||
|
||
func makeStreamMock() *StreamMock { | ||
return &StreamMock{ | ||
ctx: context.Background(), | ||
recvToServer: make(chan *stypes.SyncerServiceSyncPieceRequest, 10), | ||
} | ||
} | ||
|
||
type StreamMock struct { | ||
grpc.ClientStream | ||
ctx context.Context | ||
recvToServer chan *stypes.SyncerServiceSyncPieceRequest | ||
} | ||
|
||
func (m *StreamMock) Send(resp *stypes.SyncerServiceSyncPieceRequest) error { | ||
m.recvToServer <- resp | ||
return nil | ||
} | ||
|
||
func (m *StreamMock) CloseAndRecv() (*stypes.SyncerServiceSyncPieceResponse, error) { | ||
integrityHash, _ := base64.URLEncoding.DecodeString("pgPGdR4c9_KYz6wQxl-SifyzHXlHhx5XfNa89LzdNCI=") | ||
return &stypes.SyncerServiceSyncPieceResponse{ | ||
TraceId: "test_traceID", | ||
SecondarySpInfo: &stypes.StorageProviderSealInfo{ | ||
StorageProviderId: "sp1", | ||
PieceIdx: 1, | ||
PieceChecksum: [][]byte{[]byte("1"), []byte("2"), []byte("3"), []byte("4"), []byte("5"), []byte("6")}, | ||
IntegrityHash: integrityHash, | ||
Signature: nil, | ||
}, | ||
ErrMessage: &stypes.ErrMessage{ | ||
ErrCode: stypes.ErrCode_ERR_CODE_SUCCESS_UNSPECIFIED, | ||
ErrMsg: "Success", | ||
}, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reuse GnfdRequestIDHeader?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed