sessionrpc

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package sessionrpc contains Redeven's application RPC registrations.

It deliberately owns no transport, framing, connection, or session lifecycle. Flowersec v2 supplies those concerns through SessionHandlers and RPCPeer; this package only keeps product type IDs and JSON handlers together.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToWireError

func ToWireError(err *Error) *flowersec.RPCError

Types

type Error

type Error struct {
	Code    uint32
	Message string
}

Error is a bounded Redeven application error returned to a peer.

func (*Error) Error

func (err *Error) Error() string

type Handler

type Handler func(context.Context, json.RawMessage) (json.RawMessage, *Error)

Handler is one Redeven business RPC handler. Payload encoding is part of the product contract; Flowersec owns the enclosing RPC transport.

type RPCRegistrar

type RPCRegistrar interface {
	HandleRPC(uint32, flowersec.RPCHandler) error
}

RPCRegistrar is the smallest Flowersec registration boundary shared by an endpoint-client RPCHandlers and an accepted-session SessionHandlers. Keeping this interface role-neutral prevents client code from borrowing the accepted-server stream facade.

type Router

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

Router collects immutable product handlers before Flowersec freezes the session's handler registry.

func NewRouter

func NewRouter() *Router

func (*Router) Bind

func (router *Router) Bind(handlers RPCRegistrar) error

Bind installs the complete product handler set on Flowersec before a session is established. Unknown type IDs remain Flowersec application errors.

func (*Router) Call

func (router *Router) Call(ctx context.Context, typeID uint32, request, response any) error

Call invokes a registered business handler. It is intentionally a small in-process contract used by focused product tests; network transport remains Flowersec's RPCPeer/SessionHandlers.

func (*Router) Register

func (router *Router) Register(typeID uint32, handler Handler)

Jump to

Keyboard shortcuts

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