Skip to content

Releases: khunfloat/irpc

v0.0.3 - Partial Implementation Feature

Choose a tag to compare

@khunfloat khunfloat released this 04 Dec 01:21

Note: v0.0.2 is deprecated

This release introduces important improvements to IRPC’s contract system, enabling better flexibility and stronger validation during service registration.
The overall API remains backward-compatible.

🚀 New Features

1. Partial Contract Support (AllowPartial)

IRPC now supports registering contracts that only implement some of the interface methods.

registry := irpc.NewRegistry(irpc.Config{
    AllowPartial: true,
})

When enabled:

  • Missing interface methods are silently skipped
  • Existing registered methods continue to work
  • Useful for incremental development, mocks, and plugin systems

Default behavior remains strict (panic on missing methods).

2. Contract Implementation Validation (ValidateImpl)

Added a new API:

func (r *Registry) ValidateImpl(serviceName string, iface any)

This method verifies that a contract is already successfully implemented.
If any method is missing, the registry panics with a detailed message:

irpc: irpc: missing registered handler for ...

Ideal for startup validation and test helpers.

🛠 Improvements

  • Updated internal Registry logic to better support partial implementation and method introspection
  • README updated with complete examples, contract flow, and client usage
  • More explicit behavior documentation for override and partial modes

⚙️ Breaking Changes

None.

All existing applications using IRPC v0.0.1 will continue working without modification.

📦 Upgrading

Update using:

go get github.com/khunfloat/irpc@latest

If you want strict contract enforcement (old behavior), no config changes are required.
If you want partial support, set:

AllowPartial: true

v0.0.1 - Initial Release

Choose a tag to compare

@khunfloat khunfloat released this 02 Dec 19:19

IRPC v0.0.1 introduces a lightweight, in-process RPC mechanism for Go applications.
This release delivers the complete foundation for a clean, fast, and modular application architecture without any network overhead.

✨ Key Features

🔧 In-Process RPC Registry

A central Registry handles RPC-style calls using simple keys such as:

Exam.FindExamById
Exam.FindAllExams

No network, no boilerplate, no complexity.

⚡ Zero-Reflection on Call

Reflection is only used during registration.
Runtime calls use direct function invocation—fast and allocation-free.

📜 Contract-Based Registration

Register all methods from an interface with one line:

registry.RegisterContract("Exam", (*ExamContract)(nil), impl)

IRPC will:

  • Inspect the interface
  • Match implementation methods
  • Generate fast handlers
  • Register RPC keys automatically

🛡 Safe-by-Default Behavior

Duplicate method keys panic by default:

irpc: duplicate method key 'Exam.FindExamById'

This prevents silent overrides and reduces hidden bugs.

🔄 Optional Override Mode

Enable override behavior when needed:

registry := irpc.NewRegistry(irpc.Config{AllowOverride: true})

Perfect for plugin systems, dynamic loading, and testing.

🎯 Client Stub Support

IRPC integrates cleanly with custom client layers:

examClient := client.NewExamClient(registry)
res, _ := examClient.FindExamById(ctx, req)

This creates a gRPC-like DX without any network cost.

📦 Included in v0.0.1

  • Registry core implementation
  • Config with override support
  • Contract → Implementation binding
  • Auto method wrapper generation
  • Constant-time lookup RPC dispatcher
  • Example project (contract, client, service, main)
  • Usage guide

❤️ Thank You

Thank you for using IRPC.
This project is intentionally minimal yet powerful—built to enable clean architecture without unnecessary complexity.