feat: update binary once and push it to other servers (#15407)

This commit is contained in:
Cesar Celis Hernandez
2022-07-29 11:34:30 -04:00
committed by GitHub
parent 916f274c83
commit 8ec888d13d
5 changed files with 47 additions and 23 deletions

View File

@@ -422,16 +422,18 @@ type binaryInfo struct {
URL *url.URL
Sha256Sum []byte
ReleaseInfo string
BinaryFile []byte
}
// DownloadBinary - sends download binary message to remote peers.
func (client *peerRESTClient) DownloadBinary(ctx context.Context, u *url.URL, sha256Sum []byte, releaseInfo string) error {
// VerifyBinary - sends verify binary message to remote peers.
func (client *peerRESTClient) VerifyBinary(ctx context.Context, u *url.URL, sha256Sum []byte, releaseInfo string, readerInput []byte) error {
values := make(url.Values)
var reader bytes.Buffer
if err := gob.NewEncoder(&reader).Encode(binaryInfo{
URL: u,
Sha256Sum: sha256Sum,
ReleaseInfo: releaseInfo,
BinaryFile: readerInput,
}); err != nil {
return err
}