Documentation ¶
Overview ¶
Copyright (c) 2014-2019 Cesanta Software Limited All rights reserved
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) 2014-2019 Cesanta Software Limited All rights reserved
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 CreateCommandUID ¶
func CreateCommandUID() int64
CreateCommandUID creates a unique UID for commands.
func MarshalJSON ¶
Types ¶
type Command ¶
type Command struct { Cmd string `json:"cmd"` ID int64 `json:"id,omitempty"` Args json.RawMessage `json:"args,omitempty"` Auth *FrameAuth `json:"auth,omitempty"` // Timestamp (as number of seconds since Epoch) of when the command result is no longer relevant. Deadline int64 `json:"deadline,omitempty"` // Number of seconds after reception of the command after when the command result is no longer relevant. Timeout int64 `json:"timeout,omitempty"` Trace *Trace `json:"trace,omitempty"` }
func NewCommandFromFrame ¶
type Frame ¶
type Frame struct { // Version denotes the protocol version in use. Must be set to 1. Version int `json:"v,omitempty"` // Src is the ID of the sender. Src string `json:"src,omitempty"` // Dst is the ID of the recipient. Dst string `json:"dst,omitempty"` // Key should contains pre-shared key if client certificates are not used. Key string `json:"key,omitempty"` // Tag, if present, should be copied verbatim to the response frame. Tag string `json:"tag,omitempty"` ID int64 `json:"id,omitempty"` // Request Method string `json:"method,omitempty"` Params json.RawMessage `json:"params,omitempty"` // Timestamp (as number of seconds since Epoch) of when the command result is no longer relevant. Deadline int64 `json:"deadline,omitempty"` // Number of seconds after reception of the command after when the command result is no longer relevant. Timeout int64 `json:"timeout,omitempty"` // Response Result json.RawMessage `json:"result,omitempty"` Error *Error `json:"error,omitempty"` Trace *Trace `json:"trace,omitempty"` Auth *FrameAuth `json:"auth,omitempty"` // Size hint, if present, gives approximate size of the frame in memory. SizeHint int `json:"-"` // Send no response to this frame NoResponse bool `json:"nr,omitempty"` DeprecatedArgs json.RawMessage `json:"args,omitempty"` }
Frame is a basic data structure that contains request or response.
func NewRequestFrame ¶
func NewResponseFrame ¶
type Response ¶
type Response struct { ID int64 `json:"id"` // Status code. Non-zero value means error. Status int `json:"status"` // Human-readable explanation of an error, if any. StatusMsg string `json:"status_msg,omitempty"` // Application defined response payload Response json.RawMessage `json:"resp,omitempty"` }