Ruiboma Warlock Save

grpcpool grpc client Connection pool

Project README

warlock -- grpc client Connection pool

Build Status LICENSE GoDoc Open Source Helpers Go Report Card

This is the golang grpc client connection pool tool
Complete link state detection mechanism Every link obtained is efficient.

Project Maturity

Basic api will not have more changes. They will be discussed on Github issues along with any bugs or enhancements

Goals

Provide a few interfaces, as efficient, stable and flexible as possible.

Doc

warlock
clientFactory

HOW TO USE

go get github.com/ruiboma/warlock
package main

import (
	"github.com/ruiboma/warlock"
	"google.golang.org/grpc"
	pb "google.golang.org/grpc/examples/helloworld/helloworld"
)

func main() {

	cfg := warlock.NewConfig()
	cfg.ServerAdds = &[]string{"127.0.0.1:50051"}
    
        //  or
        cfg := warlock.NewConfig(warlock.OptionNoOverFlow, warlock.WithServerAdd(&[]string{"127.0.0.1:50051"}))
	



        pool, err := warlock.NewWarlock(cfg, grpc.WithInsecure())
	conn, close, err := pool.Acquire()
	defer close()

	
    /*
        Connection pool is not necessary for grpc
	used, free := pool.Getstat() // Can view usage and free quantities
	cfg.OverflowCap = true  This configuration may cause the existing link to exceed the total number set.
	If it overflows for a long time you need to consider increasing the value of cap.
	defer pool.ClearPool()  // Close all existing links with the pool before exiting the program
	defer close()  // It is recommended to use this, or <pool.Close(conn)> func 
    */

License

see LICENSE for more details.

Open Source Agenda is not affiliated with "Ruiboma Warlock" Project. README Source: ruiboma/warlock
Stars
37
Open Issues
3
Last Commit
3 months ago
Repository
License

Open Source Agenda Badge

Open Source Agenda Rating