irpcgen

package
v0.0.1-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package irpcgen provides functionality for code generated by iRPC tool

This code is not meant to be imported directly by users. Instead, it will be used by the generated *_irpc.go files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecBinaryUnmarshaler

func DecBinaryUnmarshaler[T encoding.BinaryUnmarshaler](dec *Decoder, dst T) error

func DecBool

func DecBool[T ~bool](dec *Decoder, v *T) error

func DecBoolSlice

func DecBoolSlice[T ~[]bool](dec *Decoder, v *T) error

func DecByteSlice

func DecByteSlice[T ~[]byte](dec *Decoder, v *T) error

func DecFloat32

func DecFloat32[T ~float32](dec *Decoder, v *T) error

func DecFloat64

func DecFloat64[T ~float64](dec *Decoder, v *T) error

func DecInt

func DecInt[T ~int](dec *Decoder, v *T) error

func DecInt8

func DecInt8[T ~int8](dec *Decoder, v *T) error

func DecInt16

func DecInt16[T ~int16](dec *Decoder, v *T) error

func DecInt32

func DecInt32[T ~int32](dec *Decoder, v *T) error

func DecInt64

func DecInt64[T ~int64](dec *Decoder, v *T) error

func DecIsNil

func DecIsNil(dec *Decoder, isNil *bool) error

func DecMap

func DecMap[M ~map[K]V, K comparable, V any](dec *Decoder, m *M, kName string, kDecFunc func(*Decoder, *K) error, vName string, vDecFunc func(*Decoder, *V) error) error

func DecPointer

func DecPointer[T any](dec *Decoder, p **T, elemType string, decFnc func(dec *Decoder, v *T) error) error

func DecSlice

func DecSlice[S ~[]E, E any](dec *Decoder, sl *S, elemType string, elemDecFnc func(*Decoder, *E) error) error

func DecString

func DecString[T ~string](dec *Decoder, v *T) error

func DecUint

func DecUint[T ~uint](dec *Decoder, v *T) error

func DecUint8

func DecUint8[T ~uint8](dec *Decoder, v *T) error

func DecUint16

func DecUint16[T ~uint16](dec *Decoder, v *T) error

func DecUint32

func DecUint32[T ~uint32](dec *Decoder, v *T) error

func DecUint64

func DecUint64[T ~uint64](dec *Decoder, v *T) error

func EncBinaryMarshaler

func EncBinaryMarshaler[T encoding.BinaryMarshaler](enc *Encoder, v T) error

func EncBool

func EncBool[T ~bool](enc *Encoder, v T) error

func EncBoolSlice

func EncBoolSlice[S ~[]bool](enc *Encoder, vs S) error

func EncByteSlice

func EncByteSlice[T ~[]byte](enc *Encoder, v T) error

func EncFloat32

func EncFloat32[T ~float32](enc *Encoder, v T) error

func EncFloat64

func EncFloat64[T ~float64](enc *Encoder, v T) error

func EncInt

func EncInt[T ~int](enc *Encoder, v T) error

func EncInt8

func EncInt8[T ~int8](enc *Encoder, v T) error

func EncInt16

func EncInt16[T ~int16](enc *Encoder, v T) error

func EncInt32

func EncInt32[T ~int32](enc *Encoder, v T) error

func EncInt64

func EncInt64[T ~int64](enc *Encoder, v T) error

func EncIsNil

func EncIsNil(enc *Encoder, isNil bool) error

func EncMap

func EncMap[M ~map[K]V, K comparable, V any](enc *Encoder, m M, kType string, kEncFunc func(*Encoder, K) error, vType string, vEncFunc func(*Encoder, V) error) error

func EncPointer

func EncPointer[T any](enc *Encoder, p *T, elemType string, encFnc func(enc *Encoder, v T) error) error

func EncSlice

func EncSlice[S ~[]E, E any](enc *Encoder, sl S, elemType string, elemEncFnc func(enc *Encoder, v E) error) error

func EncString

func EncString[T ~string](enc *Encoder, v T) error

func EncUint

func EncUint[T ~uint](enc *Encoder, v T) error

func EncUint8

func EncUint8[T ~uint8](enc *Encoder, v T) error

func EncUint16

func EncUint16[T ~uint16](enc *Encoder, v T) error

func EncUint32

func EncUint32[T ~uint32](enc *Encoder, v T) error

func EncUint64

func EncUint64[T ~uint64](enc *Encoder, v T) error

Types

type ArgDeserializer

type ArgDeserializer func(d *Decoder) (FuncExecutor, error)

ArgDeserializer deserializes function arguments from a Decoder and returns a FuncExecutor that performs the function call.

type Decoder

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

Decoder is a binary decoder that reads various data types from an io.Reader.

It is meant to be used by generated code to decode messages in the IRPC protocol.

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

type Deserializable

type Deserializable interface {
	Deserialize(d *Decoder) error
}

Deserializable initializes its state from a Decoder.

type EmptyDeserializable

type EmptyDeserializable struct{}

EmptyDeserializable is a no-op implementation of Deserializable.

func (EmptyDeserializable) Deserialize

func (EmptyDeserializable) Deserialize(d *Decoder) error

type EmptySerializable

type EmptySerializable struct{}

EmptySerializable is a no-op implementation of Serializable.

func (EmptySerializable) Serialize

func (EmptySerializable) Serialize(e *Encoder) error

type Encoder

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

Encoder serializes given data type to byte stream. Encoder is meant to be used by generated code, not directly by the user.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) Flush

func (e *Encoder) Flush() error

Flush writes any buffered data to the underlying io.Writer.

type Endpoint

type Endpoint interface {
	// RegisterClient registers a client with the peer Endpoint.
	RegisterClient(serviceId []byte) error
	// CallRemoteFunc invokes a function on the peer Endpoint.
	CallRemoteFunc(ctx context.Context, serviceId []byte, funcId FuncId, params Serializable, resp Deserializable) error
}

Endpoint represents one side of an active RPC connection. Each Endpoint communicates with one peer Endpoint on the other side.

type FuncExecutor

type FuncExecutor func(ctx context.Context) Serializable

FuncExecutor wraps a function call and returns its result as Serializable.

type FuncId

type FuncId uint64

type Serializable

type Serializable interface {
	Serialize(e *Encoder) error
}

Serializable serializes its state using an Encoder

type Service

type Service interface {
	// Id returns the unique identifier of the service.
	Id() []byte

	// GetFuncCall returns a deserializer for the given function ID.
	GetFuncCall(funcId FuncId) (ArgDeserializer, error)
}

Service defines a collection of RPC-callable functions.

Jump to

Keyboard shortcuts

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