boltclient

package
v0.0.0-...-c671013 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ProtocolCodeV1 byte = 1

	RequestType  byte = 1
	ResponseType byte = 0

	CmdCodeRPCRequest  uint16 = 1
	CmdCodeRPCResponse uint16 = 2
	CmdVersion         byte   = 1

	// BOLT wire codec byte for Hessian payloads. This is distinct from
	// SOFARPC's higher-level serializer constants such as
	// SERIALIZE_CODE_HESSIAN2 = 4.
	CodecHessian2 byte = 1
	// CodecJSON is the code SOFARPC registers its Jackson serializer under
	// (@Extension(value = "json", code = 12)).
	CodecJSON byte = 12

	// Response statuses the provider's remoting layer sets when the SOFARPC
	// serializer fails: it could not encode the result, or could not decode
	// the request.
	StatusServerSerialException   uint16 = 0x0011
	StatusServerDeserialException uint16 = 0x0012

	// DefaultMaxResponseBytes caps the BOLT response body before allocating
	// class/header/content buffers. It covers the variable-length body only;
	// the fixed 20-byte response header is read separately.
	DefaultMaxResponseBytes int64 = 16 << 20
)
View Source
const (
	StageEncode = "encode"
	StageDial   = "dial"
	StageWrite  = "write"
	StageRead   = "read"

	RequestNotSent      = "not-sent"
	RequestWriteUnknown = "write-uncertain"
	RequestWritten      = "request-written"
)

Variables

This section is empty.

Functions

func DecodeSimpleMap

func DecodeSimpleMap(data []byte) (map[string]string, error)

func EncodeRequest

func EncodeRequest(req Request) ([]byte, error)

func EncodeSimpleMap

func EncodeSimpleMap(values map[string]string) ([]byte, error)

Types

type AttemptError

type AttemptError struct {
	Stage        string
	RequestState string
	Cause        error
}

AttemptError records the failed stage and what the client observed about writing the request. A complete socket write does not establish delivery.

func (*AttemptError) Error

func (e *AttemptError) Error() string

func (*AttemptError) Unwrap

func (e *AttemptError) Unwrap() error

type Request

type Request struct {
	RequestID      uint32
	RequestClass   string
	Header         map[string]string
	Content        []byte
	Codec          byte
	Timeout        time.Duration
	ConnectTimeout time.Duration

	// MaxResponseBytes caps the variable-length response body. A value <= 0
	// uses DefaultMaxResponseBytes.
	MaxResponseBytes int64
}

type Response

type Response struct {
	ProtocolCode   byte
	Type           byte
	CmdCode        uint16
	CmdVersion     byte
	RequestID      uint32
	Codec          byte
	ResponseStatus uint16
	ResponseClass  string
	Header         map[string]string
	Content        []byte
	Raw            []byte
}

func Invoke

func Invoke(ctx context.Context, addr string, req Request) (Response, error)

func ReadResponse

func ReadResponse(r io.Reader) (Response, error)

func ReadResponseWithLimit

func ReadResponseWithLimit(r io.Reader, maxBodyBytes int64) (Response, error)

Jump to

Keyboard shortcuts

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