bus

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConnClosed = xerrors.NewSentinel("connection closed")

Functions

func WithAckTimeout

func WithAckTimeout(timeout time.Duration) *sendOption

func WithAttachmentStrings

func WithAttachmentStrings(attachments ...string) *sendOption

func WithAttachments

func WithAttachments(attachments ...[]byte) *sendOption

func WithCredentials

func WithCredentials(credentials Credentials) *sendOption

func WithDeclaredClientFeatureIDs

func WithDeclaredClientFeatureIDs(ids ...int32) *sendOption

func WithProtocolVersionMajor

func WithProtocolVersionMajor(v int32) *sendOption

func WithRequestCodec

func WithRequestCodec(codecID compression.CodecID) *sendOption

func WithRequestID

func WithRequestID(id guid.GUID) *sendOption

func WithRequestTimeout

func WithRequestTimeout(timeout time.Duration) *sendOption

func WithRequiredServerFeatureIDs

func WithRequiredServerFeatureIDs(ids ...int32) *sendOption

func WithResponseAttachments

func WithResponseAttachments(attachments *[][]byte) *sendOption

func WithResponseCodec

func WithResponseCodec(codecID compression.CodecID) *sendOption

func WithToken

func WithToken(token string) *sendOption

func WithTracing

func WithTracing(traceID guid.GUID, spanID uint64, flags byte) *sendOption

func WithUser

func WithUser(user string) *sendOption

func WithUserTag

func WithUserTag(tag string) *sendOption

func WithoutRequestAcknowledgement

func WithoutRequestAcknowledgement() *sendOption

Types

type AttributeKey

type AttributeKey string
const (
	AttributeKeyFeatureID   AttributeKey = "feature_id"
	AttributeKeyFeatureName AttributeKey = "feature_name"
)

type Bus

type Bus struct {
	// contains filtered or unexported fields
}

func Dial

func Dial(ctx context.Context, options Options) (*Bus, error)

func NewBus

func NewBus(conn net.Conn, options Options) *Bus

func (*Bus) Close

func (c *Bus) Close()

func (*Bus) Receive

func (c *Bus) Receive() (busMsg, error)

func (*Bus) Send

func (c *Bus) Send(packetID guid.GUID, packetData [][]byte, opts *busSendOptions) error

type ClientConn

type ClientConn struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, address string, opts ...ClientOption) *ClientConn

func (*ClientConn) Close

func (c *ClientConn) Close()

func (*ClientConn) Done

func (c *ClientConn) Done() <-chan struct{}

func (*ClientConn) Err

func (c *ClientConn) Err() (err error)

func (*ClientConn) Send

func (c *ClientConn) Send(
	ctx context.Context,
	service, method string,
	request, reply proto.Message,
	opts ...SendOption,
) error

type ClientOption

type ClientOption func(conn *ClientConn)

func WithDefaultProtocolVersionMajor

func WithDefaultProtocolVersionMajor(v int32) ClientOption

func WithFeatureIDFormatter

func WithFeatureIDFormatter(f featureIDFormatter) ClientOption

func WithLogger

func WithLogger(l log.Logger) ClientOption

type Credentials

type Credentials interface {
	SetExtension(req *rpc.TRequestHeader)
}

type DeliveryTrackingLevel

type DeliveryTrackingLevel int
const (
	DeliveryTrackingLevelNone      DeliveryTrackingLevel = 0
	DeliveryTrackingLevelErrorOnly DeliveryTrackingLevel = 1
	DeliveryTrackingLevelFull      DeliveryTrackingLevel = 2
)

type Options

type Options struct {
	Address string
	Logger  log.Logger
}

type SendOption

type SendOption interface {
	// contains filtered or unexported methods
}

type SendOptionAfterFunc

type SendOptionAfterFunc func(req *clientReq)

SendOptionAfterFunc type is an adapter to allow the use of ordinary functions as SendOption's after method.

type SendOptionBeforeFunc

type SendOptionBeforeFunc func(req *clientReq)

SendOptionBeforeFunc type is an adapter to allow the use of ordinary functions as SendOption's before method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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