stringify cluster commands in log
This commit is contained in:
1 parent
400410c449
commit
96dee8dee3
3 files changed
+46
-7
No files matched your search
+8
-3
@@ -17,8 +17,13 @@ const (
|
||||
|
||||
ClusterParam = "cluster"
|
||||
)
|
||||
|
||||
type Command uint64
|
||||
|
||||
// need: go get golang.org/x/tools/cmd/stringer
|
||||
//go:generate stringer -type=Command -output const_string.go
|
||||
const (
|
||||
_ = iota
|
||||
_ Command = iota
|
||||
UpdateBackendDeclarationCommand
|
||||
DeleteBackendDeclarationCommand
|
||||
|
||||
@@ -80,9 +85,9 @@ func PrepareUpsertCommonConfigCommand(config UpsertCommonConfig) []byte {
|
||||
return prepareCommand(UpsertCommonConfigCommand, config)
|
||||
}
|
||||
|
||||
func prepareCommand(command uint64, payload interface{}) []byte {
|
||||
func prepareCommand(command Command, payload interface{}) []byte {
|
||||
cmd := make([]byte, 8)
|
||||
binary.BigEndian.PutUint64(cmd, command)
|
||||
binary.BigEndian.PutUint64(cmd, uint64(command))
|
||||
buf := bytes.NewBuffer(cmd)
|
||||
err := json.NewEncoder(buf).Encode(payload)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user