idl

package
v0.10.10 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package idl represents an Interface Definition Language (IDL) for gRPC. In general, Protocol Buffers is used as the IDL. However, it is possible to use another IDLs such that FlatBuffers.

Note that IDLs are independent from encoding.Codec of gRPC. It is possible to use a different languages for interface defining and encoding (e.g. use Protocol Buffers as an IDL, and use JSON as a codec).

Currently, Evans only supports Protocol Buffers as an IDL.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPackageUnselected = errors.New("package unselected")
	ErrServiceUnselected = errors.New("service unselected")

	ErrUnknownPackageName = errors.New("unknown package name")
	ErrUnknownServiceName = errors.New("unknown service name")
	ErrUnknownRPCName     = errors.New("unknown RPC name")
	ErrUnknownSymbol      = errors.New("unknown symbol")
)

Functions

func FullyQualifiedMethodName added in v0.9.0

func FullyQualifiedMethodName(fqsn, methodName string) (string, error)

FullyQualifiedMethodName returns the fully-qualified method joined with '.'.

Types

type Spec

type Spec interface {
	// ServiceNames returns all service names the spec loaded.
	// Service names are fully-qualified (the form of <package>.<service> in Protocol Buffers3).
	// The returned slice is ordered by ascending order.
	ServiceNames() []string

	// RPCs returns all RPC names belongs to the passed fully-qualified service name svcName.
	// RPCs may return these errors:
	//
	//   - ErrServiceUnselected: svcName is empty.
	//   - ErrUnknownServiceName: svcName is not contained to ServiceNames().
	//
	RPCs(svcName string) ([]*grpc.RPC, error)

	// RPC returns the RPC that is specified by svcName and rpcName.
	// RPC may return these errors:
	//
	//   - ErrServiceUnselected: svcName is empty.
	//   - ErrUnknownServiceName: svcName is not contained to ServiceNames().
	//   - ErrUnknownRPCName: rpcName is not contained to RPCs().
	//
	RPC(svcName, rpcName string) (*grpc.RPC, error)

	// ResolveSymbol returns the descriptor of a symbol.
	// The symbol should be fully-qualified (the form of <package>.<message> in Protocol Buffers3).
	// The returned descriptor depends to an codec such that Protocol Buffers.
	// ResolveSymbol may returns these errors:
	//
	//   - ErrUnknownSymbol: symbol is not loaded.
	//
	ResolveSymbol(symbol string) (interface{}, error)

	// FormatDescriptor formats v according to its IDL type.
	FormatDescriptor(v interface{}) (string, error)
}

Spec represents the interface specification from loaded IDL files.

Directories

Path Synopsis
Package proto implements idl.Spec for Protocol Buffers.
Package proto implements idl.Spec for Protocol Buffers.

Jump to

Keyboard shortcuts

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