예제 #1
0
func main() {
	if len(os.Args) < 2 {
		fmt.Println("usage: %s hfileserver")
		os.Exit(1)
	}

	url := os.Args[1]

	if !strings.Contains(url, "/") {
		url = url + "/rpc/HFileService"
	}
	if !strings.HasPrefix(url, "http") {
		url = "http://" + url
	}

	recv, send := thriftrpc.NewClientProts(url, false)
	client := gen.NewHFileServiceClientProtocol(nil, recv, send)

	r := &gen.InfoRequest{nil, nil}
	if resp, err := client.GetInfo(r); err != nil {
		fmt.Println("Error getting info:", err)
		os.Exit(1)
	} else {
		for _, v := range resp {
			fmt.Printf("%s:\n", v.GetName())
			fmt.Printf("\tpath:\t%s\n", removeWebhdfs(v.GetPath()))
			fmt.Printf("\tkeys:\t%d\n", v.GetNumElements())
			fmt.Printf("\tstart:\t%s\n", hex.EncodeToString(v.GetFirstKey()))
			fmt.Printf("\tend:\t%s\n", hex.EncodeToString(v.GetLastKey()))
		}
	}
}
예제 #2
0
파일: load.go 프로젝트: jcdavis/quiver
func GetQuiverClient(url func() string) *gen.HFileServiceClient {
	recv, send := thriftrpc.NewDynamicClientProts(url, false)
	return gen.NewHFileServiceClientProtocol(nil, recv, send)
}
예제 #3
0
파일: main_test.go 프로젝트: jcdavis/quiver
func DummyClient(url string, compact bool) *gen.HFileServiceClient {
	recv, send := thriftrpc.NewClientProts(url, compact)
	return gen.NewHFileServiceClientProtocol(nil, recv, send)
}