Beispiel #1
0
func parseListenerPack(v []byte) (*engine.Listener, error) {
	var lp listenerReadPack
	if err := json.Unmarshal(v, &lp); err != nil {
		return nil, err
	}
	if len(lp.Listener) == 0 {
		return nil, &scroll.MissingFieldError{Field: "Listener"}
	}
	return engine.ListenerFromJSON(lp.Listener)
}
Beispiel #2
0
func (n *ng) GetListener(key engine.ListenerKey) (*engine.Listener, error) {
	bytes, err := n.getVal(n.path("listeners", key.Id))
	if err != nil {
		return nil, err
	}
	l, err := engine.ListenerFromJSON([]byte(bytes), key.Id)
	if err != nil {
		return nil, err
	}
	return l, nil
}