Documentation ¶
Overview ¶
Copyright (c) 2020, Arm Limited and affiliates. SPDX-License-Identifier: Apache-2.0 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2020, Arm Limited and affiliates. SPDX-License-Identifier: Apache-2.0 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func Gcd_init(config *maestroConfig.GcdConfig)
- type Client
- func (c *Client) Call(method string, args interface{}, result interface{}) error
- func (c *Client) CallWithContext(ctx context.Context, method string, args interface{}, result interface{}) error
- func (c *Client) CallWithTimeout(method string, args interface{}, result interface{}, duration time.Duration) error
- func (c *Client) CancelRequestReceiver()
- func (c *Client) Close()
- func (c *Client) IsEmpty() bool
- func (c *Client) RegisterRequestReceiver() (<-chan []byte, error)
- func (c *Client) Respond(id string, res *json.RawMessage, err *json.RawMessage) error
- func (c *Client) RespondWithContext(ctx context.Context, id string, res *json.RawMessage, err *json.RawMessage) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Gcd_init ¶
func Gcd_init(config *maestroConfig.GcdConfig)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an connection to a Json RPC server
func Dial ¶
Dial initializes a background context and creates a new client for the given unix domain socket and API path
Currently the dial function is dedicated to establish a local unix domain socket connection using UNIX domain sockets based on websocket connection.
The client reconnects automatically if the connection is lost
func DialWithContext ¶
DialWithContext creates a new client to connect to the server
func (*Client) Call ¶
Call initializes a background context and performs a JSON-RPC call with the given arguments and unmarshals into result if no error occured
The result must be a pointer so that package json can unmarshal into it. Nil object should not be passed into
future improvement: could deliver error message as well
func (*Client) CallWithContext ¶
func (c *Client) CallWithContext(ctx context.Context, method string, args interface{}, result interface{}) error
CallWithContext performs a JSON-RPC call with the given arguments and unmarshals into result if no error occured
func (*Client) CallWithTimeout ¶
func (c *Client) CallWithTimeout(method string, args interface{}, result interface{}, duration time.Duration) error
CallWithTimeout performs a JSON-RPC call with the given arguments and unmarshals into result if no error occured within the given timeout
func (*Client) CancelRequestReceiver ¶
func (c *Client) CancelRequestReceiver()
CancelRequestReceiver deregisters the channel that recives non-response message from json rpc server
func (*Client) Close ¶
func (c *Client) Close()
Close terminates the connection between the client and the websocket server, aborting any in-flight calls
func (*Client) RegisterRequestReceiver ¶
RegisterRequestReceiver registers a channel that receives non-response message from json rpc server
func (*Client) Respond ¶
func (c *Client) Respond(id string, res *json.RawMessage, err *json.RawMessage) error
Respond initialized a background context and send the response back to the established json rpc client if there is any. Please note that either `res` or `err` could be nil
func (*Client) RespondWithContext ¶
func (c *Client) RespondWithContext(ctx context.Context, id string, res *json.RawMessage, err *json.RawMessage) error
RespondWithContext sends out the response back to the established json rpc client