You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
647 B

  1. package operation
  2. import (
  3. "context"
  4. "google.golang.org/grpc"
  5. "time"
  6. "github.com/chrislusf/seaweedfs/weed/pb/master_pb"
  7. )
  8. func Statistics(server string, grpcDialOption grpc.DialOption, req *master_pb.StatisticsRequest) (resp *master_pb.StatisticsResponse, err error) {
  9. err = withMasterServerClient(server, grpcDialOption, func(masterClient master_pb.SeaweedClient) error {
  10. ctx, cancel := context.WithTimeout(context.Background(), time.Duration(5*time.Second))
  11. defer cancel()
  12. grpcResponse, grpcErr := masterClient.Statistics(ctx, req)
  13. if grpcErr != nil {
  14. return grpcErr
  15. }
  16. resp = grpcResponse
  17. return nil
  18. })
  19. return
  20. }