aboutsummaryrefslogtreecommitdiff
path: root/weed/operation/stats.go
blob: 364727272028b7b6496c8158eefaed2aabd291b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package operation

import (
	"context"
	"time"

	"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
)

func Statistics(server string, req *master_pb.StatisticsRequest) (resp *master_pb.StatisticsResponse, err error) {

	err = withMasterServerClient(server, func(masterClient master_pb.SeaweedClient) error {
		ctx, cancel := context.WithTimeout(context.Background(), time.Duration(5*time.Second))
		defer cancel()

		grpcResponse, grpcErr := masterClient.Statistics(ctx, req)
		if grpcErr != nil {
			return grpcErr
		}

		resp = grpcResponse

		return nil

	})

	return
}