-
Notifications
You must be signed in to change notification settings - Fork 0
/
encode_decode.go
26 lines (18 loc) · 1.08 KB
/
encode_decode.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package wirenettransport
import (
"context"
"io"
"github.com/mediabuyerbot/go-wirenet"
)
// EncodeRequestFunc encodes the passed request object into the wirenet request object.
type EncodeRequestFunc func(context.Context, interface{}, io.WriteCloser) error
// DecodeResponseFunc extracts a user-domain response object from a wirenet response object.
type DecodeResponseFunc func(context.Context, io.ReadCloser) (response interface{}, err error)
// DecodeRequestFunc extracts a user-domain request object from a wirenet request.
type DecodeRequestFunc func(context.Context, io.ReadCloser) (request interface{}, err error)
// EncodeResponseFunc encodes the passed response object to the wirenet response message.
type EncodeResponseFunc func(context.Context, interface{}, io.WriteCloser) error
// ClientCodec encodes and decodes the byte stream in the user-domain.
type ClientCodec func(context.Context, interface{}, wirenet.Stream) (interface{}, error)
// ServerCodec encodes and decodes the byte stream in the user-domain.
type ServerCodec func(context.Context, wirenet.Stream) (interface{}, error)