package redis_protocol_crawler

import (
	"encoding/json"
	config "git.loafle.net/overflow/overflow_probe/agent_api/config_manager"
	"git.loafle.net/overflow/overflow_probe/crawler"
	"git.loafle.net/overflow/overflow_probe/matcher/redis"
)

type RedisHeahthCrawler struct {
	crawler.SocketHeahthCrawler
}

func (r *RedisHeahthCrawler) Internal(params config.Config) ([]byte, error) {

	b, err := r.CheckHeahth(params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(b)
}

func NewRedisHeahthCrawler() *RedisHeahthCrawler {
	r := &RedisHeahthCrawler{}
	r.SetInternal(r)
	r.SetMatcher(redis.NewRedisMatcher())
	return r
}
