gcd

package
Version: v2.10.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

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

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

func Dial(socket string, path string, onConn onConnection) *Client

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

func DialWithContext(ctx context.Context, socket string, path string, onConn onConnection) *Client

DialWithContext creates a new client to connect to the server

func (*Client) Call

func (c *Client) Call(method string, args interface{}, result interface{}) error

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) IsEmpty

func (c *Client) IsEmpty() bool

IsEmpty return true while the client has been initialized yet

func (*Client) RegisterRequestReceiver

func (c *Client) RegisterRequestReceiver() (<-chan []byte, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL