// Call calls a method remotelly
355832
func (ns *NatsRPCClient) Call(
	ctx context.Context,
	rpcType protos.RPCType,
	route *route.Route,
	session *session.Session,
	msg *message.Message,
	server *Server,
) (*protos.Response, error) {
	parent, err := tracing.ExtractSpan(ctx)
	if err != nil {
		logger.Log.Warnf("failed to retrieve parent span: %s", err.Error())
	}
	tags := opentracing.Tags{
		"span.kind":       "client",
		"local.id":        ns.server.ID,
		"peer.serverType": server.Type,
		"peer.id":         server.ID,
	}
	ctx = tracing.StartSpan(ctx, "RPC Call", tags, parent)
	defer tracing.FinishSpan(ctx, err)

	if !ns.running {
		err = constants.ErrRPCClientNotInitialized
		return nil, err
	}
	req, err := buildRequest(ctx, rpcType, route, session, msg, ns.server)
	if err != nil {
		return nil, err
	}
	marshalledData, err := proto.Marshal(&req)
	if err != nil {
		return nil, err
	}

	var m *nats.Msg

	if ns.metricsReporters != nil {
		startTime := time.Now()
		ctx = pcontext.AddToPropagateCtx(ctx, constants.StartTimeKey, startTime.UnixNano())
		ctx = pcontext.AddToPropagateCtx(ctx, constants.RouteKey, route.String())
		defer func() {
			typ := "rpc"
			metrics.ReportTimingFromCtx(ctx, ns.metricsReporters, typ, err)
		}()
	}
	m, err = ns.conn.Request(getChannel(server.Type, server.ID), marshalledData, ns.reqTimeout)
	if err != nil {
		return nil, err
	}

	res := &protos.Response{}
	err = proto.Unmarshal(m.Data, res)
	if err != nil {
		return nil, err
	}

	if res.Error != nil {
		if res.Error.Code == "" {
			res.Error.Code = errors.ErrUnknownCode
		}
		err = &errors.Error{
			Code:     res.Error.Code,
			Message:  res.Error.Msg,
			Metadata: res.Error.Metadata,
		}
		return nil, err
	}
	return res, nil
}
159848
func Call(ctx context.Context, request Request, response interface{}, opts ...CallOption) error {
	return DefaultClient.Call(ctx, request, response, opts...)
}
1008562
func (s *ExtensionManagerServer) Call(ctx context.Context, registry string, item string, request osquery.ExtensionPluginRequest) (*osquery.ExtensionResponse, error) {
	subreg, ok := s.registry[registry]
	if !ok {
		return &osquery.ExtensionResponse{
			Status: &osquery.ExtensionStatus{
				Code:    1,
				Message: "Unknown registry: " + registry,
			},
		}, nil
	}

	plugin, ok := subreg[item]
	if !ok {
		return &osquery.ExtensionResponse{
			Status: &osquery.ExtensionStatus{
				Code:    1,
				Message: "Unknown registry item: " + item,
			},
		}, nil
	}

	response := plugin.Call(context.Background(), request)
	return &response, nil
}
1059037
func (_PublicResolver *PublicResolverRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
	return _PublicResolver.Contract.PublicResolverCaller.contract.Call(opts, result, method, params...)
}
310053
func (gs *GRPCClient) Call(ctx context.Context, rpcType protos.RPCType, route *route.Route, session *session.Session, msg *message.Message, server *Server) (*protos.Response, error) {
	parent, err := tracing.ExtractSpan(ctx)
	if err != nil {
		logger.Log.Warnf("failed to retrieve parent span: %s", err.Error())
	}
	tags := opentracing.Tags{
		"span.kind":       "client",
		"local.id":        gs.server.ID,
		"peer.serverType": server.Type,
		"peer.id":         server.ID,
	}
	ctx = tracing.StartSpan(ctx, "RPC Call", tags, parent)
	defer tracing.FinishSpan(ctx, err)

	req, err := buildRequest(ctx, rpcType, route, session, msg, gs.server)
	if err != nil {
		return nil, err
	}
	if c, ok := gs.clientMap.Load(server.ID); ok {
		ctxT, done := context.WithTimeout(ctx, gs.reqTimeout)
		defer done()

		if gs.metricsReporters != nil {
			startTime := time.Now()
			ctxT = pcontext.AddToPropagateCtx(ctxT, constants.StartTimeKey, startTime.UnixNano())
			ctxT = pcontext.AddToPropagateCtx(ctxT, constants.RouteKey, route.String())
			defer metrics.ReportTimingFromCtx(ctxT, gs.metricsReporters, "rpc", err)
		}

		res, err := c.(protos.PitayaClient).Call(ctxT, &req)
		if err != nil {
			return nil, err
		}
		if res.Error != nil {
			if res.Error.Code == "" {
				res.Error.Code = pitErrors.ErrUnknownCode
			}
			err = &pitErrors.Error{
				Code:     res.Error.Code,
				Message:  res.Error.Msg,
				Metadata: res.Error.Metadata,
			}
			return nil, err
		}
		return res, nil

	}
	return nil, constants.ErrNoConnectionToServer
}
394336
func Call(caller calls.Caller) Rule {
	if caller == nil {
		return nil
	}
	return func(ctx context.Context, c *scheduler.Call, _ mesos.Response, _ error, ch Chain) (context.Context, *scheduler.Call, mesos.Response, error) {
		resp, err := caller.Call(ctx, c)
		return ch(ctx, c, resp, err)
	}
}
635925
func (c *ExtensionManagerClient) Call(registry, item string, request osquery.ExtensionPluginRequest) (*osquery.ExtensionResponse, error) {
	return c.Client.Call(context.Background(), registry, item, request)
}
21712
func (obj *fakeObject) Call(method string, flags godbus.Flags, args ...interface{}) Call {
	ret, err := obj.handler(method, args...)
	return &fakeCall{ret, err}
}
74789
func (client *Client) Call(serviceMethod string, args interface{}, reply interface{}) error {
	call := <-client.Go(serviceMethod, args, reply, make(chan *Call, 1)).Done
	return call.Error
}
1237950
func (f Function) Call(args ...interface{}) error {
	if !f.IsValid() {
		return errors.New("invalid function")
	}
	return f.Caller.Call(args...)
}
1067923
func (c *Client) Call(serviceMethod string, args []interface{}, reply interface{}) error {
	rpc, err := xmlrpc.NewClient(c.Url, nil)
	if err != nil {
		return err
	}
	return rpc.Call(serviceMethod, args, reply)
}
823474
func (f CallerFunc) Call(ctx context.Context, c *scheduler.Call) (mesos.Response, error) {
	return f(ctx, c)
}
582950
func (c *client) call(req []byte) (reply interface{}, err error) {
	c.mu.Lock()
	defer c.mu.Unlock()

	msg := make([]byte, 4+len(req))
	binary.BigEndian.PutUint32(msg, uint32(len(req)))
	copy(msg[4:], req)
	if _, err = c.conn.Write(msg); err != nil {
		return nil, clientErr(err)
	}

	var respSizeBuf [4]byte
	if _, err = io.ReadFull(c.conn, respSizeBuf[:]); err != nil {
		return nil, clientErr(err)
	}
	respSize := binary.BigEndian.Uint32(respSizeBuf[:])
	if respSize > maxAgentResponseBytes {
		return nil, clientErr(err)
	}

	buf := make([]byte, respSize)
	if _, err = io.ReadFull(c.conn, buf); err != nil {
		return nil, clientErr(err)
	}
	reply, err = unmarshal(buf)
	if err != nil {
		return nil, clientErr(err)
	}
	return reply, err
}
354117
func (m *MockRPCClient) Call(ctx context.Context, rpcType protos.RPCType, route *route.Route, session *session.Session, msg *message.Message, server *cluster.Server) (*protos.Response, error) {
	ret := m.ctrl.Call(m, "Call", ctx, rpcType, route, session, msg, server)
	ret0, _ := ret[0].(*protos.Response)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
924877
func (nc *nccClient) call(name string, in interface{}, out interface{}) error {
	nc.lock.RLock()
	client := nc.client
	nc.lock.RUnlock()
	if client == nil {
		return fmt.Errorf("Not connected")
	}
	ch := make(chan error, 1)
	go func() {
		ch <- client.Call(name, in, out)
	}()
	select {
	case err := <-ch:
		return err
	case <-time.After(nccRPCTimeout):
		return fmt.Errorf("RPC call timed out after %v", nccRPCTimeout)
	}
}
647345
func (d *Dispatch) Call(method string, params ...interface{}) (result *VARIANT, err error) {
	id, err := d.GetId(method)
	if err != nil {
		return
	}

	result, err = d.Invoke(id, DISPATCH_METHOD, params)
	return
}
52093
func (ie *InitEvent) call() {
	log.Debug("OnInit callbacks executing")
	defer log.Debug("OnInit callbacks finished")
	for _, ev := range *ie {
		ev()
	}
}