types

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Overview

Copyright 2020 The arhat.dev Authors.

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 2020 The arhat.dev Authors.

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

This section is empty.

Types

type Codec

type Codec interface {
	// Type is the codec kind
	Type() arhatgopb.CodecType

	// NewEncoder creates a new Encoder which will encode messages to the Writer
	NewEncoder(w io.Writer) Encoder

	// NewEncoder creates a new Decoder which will decode messages from the Reader
	NewDecoder(r io.Reader) Decoder

	// Unmarshal non stream data
	Unmarshal(data []byte, out interface{}) error

	// Marshal v as non stream data
	Marshal(v interface{}) ([]byte, error)
}

Codec knows how to encode/decode all kinds of data, including stream data

type Decoder

type Decoder interface {
	// Decode one message from stream
	Decode(out interface{}) error
}

Decoder for stream data decoding

type Encoder

type Encoder interface {
	// Encode one message to stream
	Encode(any interface{}) error
}

Encoder for stream data encoding

type Handler

type Handler interface {
	// HandleCmd process one command per function call, payload is non stream data
	HandleCmd(id uint64, kind arhatgopb.CmdType, payload []byte) (interface{}, error)
}

Handler for controller

type MarshalFunc added in v0.3.0

type MarshalFunc func(v interface{}) ([]byte, error)

type UnmarshalFunc added in v0.3.0

type UnmarshalFunc func(data []byte, out interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL