Open adyatlov opened 5 years ago
Check the number of requests per hour to Marathon in Adminrouter. Sketch:
package main import ( "bytes" "encoding/base64" "encoding/gob" "errors" "fmt" ) type Hello struct { Greeting string } type Bye struct { HelloSaid Hello Byesaid Hello } func (b1 Bye) Serialize() (string, error) { var b bytes.Buffer e := gob.NewEncoder(&b) err := e.Encode(b1) if err != nil { return "", errors.New("serialization failed") } return base64.StdEncoding.EncodeToString(b.Bytes()), nil } func DeserializeBye(str string) (Bye, error) { m := Bye{} by, err := base64.StdEncoding.DecodeString(str) if err != nil { return m, errors.New("deserialization failed") } b := bytes.Buffer{} b.Write(by) d := gob.NewDecoder(&b) err = d.Decode(&m) if err != nil { return m, errors.New("deserialization failed") } return m, nil } func main() { h := Hello{Greeting: "hello"} b := Bye{HelloSaid: h, Byesaid: h} serialized, err := b.Serialize() if err != nil { fmt.Println(err) } fmt.Println(serialized) }
Check the number of requests per hour to Marathon in Adminrouter. Sketch: