reverse

package
v3.0.16 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caller

type Caller struct {
	*core.Service
	IdleTimeout time.Duration
	Timeout     time.Duration
	HeartBeat   time.Duration
	// contains filtered or unexported fields
}

func NewCaller

func NewCaller(service *core.Service) *Caller

func UseService

func UseService(ctx context.Context, remoteService interface{}, namespace ...string) *Caller

func (*Caller) Exists

func (c *Caller) Exists(id string) bool

func (*Caller) ID

func (c *Caller) ID(ctx context.Context) (id string)

func (*Caller) IdList

func (c *Caller) IdList() []string

func (*Caller) Invoke

func (c *Caller) Invoke(id string, name string, args []interface{}, returnType ...reflect.Type) ([]interface{}, error)

func (*Caller) InvokeContext

func (c *Caller) InvokeContext(ctx context.Context, id string, name string, args []interface{}, returnType ...reflect.Type) ([]interface{}, error)

func (*Caller) UseService

func (c *Caller) UseService(remoteService interface{}, id string, namespace ...string)

type Provider

type Provider struct {
	RetryInterval time.Duration
	OnError       func(error)
	Debug         bool
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(client *core.Client, id ...string) *Provider

func (*Provider) Add

func (p *Provider) Add(method core.Method) *Provider

Add is used for publishing the method.

func (*Provider) AddAllMethods

func (p *Provider) AddAllMethods(target interface{}, namespace ...string) *Provider

AddAllMethods will publish all methods and non-nil function fields on the obj self and on its anonymous or non-anonymous struct fields (or pointer to pointer ... to pointer struct fields). This is a recursive operation. So it's a pit, if you do not know what you are doing, do not step on.

func (*Provider) AddFunction

func (p *Provider) AddFunction(f interface{}, alias ...string) *Provider

AddFunction is used for publishing function f with alias.

func (*Provider) AddInstanceMethods

func (p *Provider) AddInstanceMethods(target interface{}, namespace ...string) *Provider

AddInstanceMethods is used for publishing all the public methods and func fields with namespace.

func (*Provider) AddMethod

func (p *Provider) AddMethod(name string, target interface{}, alias ...string) *Provider

AddMethod is used for publishing method named name on target with alias.

func (*Provider) AddMethods

func (p *Provider) AddMethods(names []string, target interface{}, namespace ...string) *Provider

AddMethods is used for publishing methods named names on target with namespace.

func (*Provider) AddMissingMethod

func (p *Provider) AddMissingMethod(f interface{}) *Provider

AddMissingMethod is used for publishing a method, all methods not explicitly published will be redirected to this method.

func (*Provider) AddNetRPCMethods

func (p *Provider) AddNetRPCMethods(rcvr interface{}, namespace ...string) *Provider

AddNetRPCMethods is used for publishing methods defined for net/rpc.

func (*Provider) Client

func (p *Provider) Client() *core.Client

func (*Provider) Close

func (p *Provider) Close() error

func (*Provider) Execute

func (p *Provider) Execute(ctx context.Context, name string, args []interface{}) (result []interface{}, err error)

func (*Provider) Get

func (p *Provider) Get(name string) core.Method

Get returns the published method by name.

func (*Provider) ID

func (p *Provider) ID() (id string)

func (*Provider) Listen

func (p *Provider) Listen()

func (*Provider) Remove

func (p *Provider) Remove(name string) *Provider

Remove is used for unpublishing method by the specified name.

func (*Provider) SetID

func (p *Provider) SetID(id string)

func (*Provider) Unuse

func (p *Provider) Unuse(handler ...core.PluginHandler) *Provider

Unuse plugin handlers.

func (*Provider) Use

func (p *Provider) Use(handler ...core.PluginHandler) *Provider

Use plugin handlers.

type ProviderContext

type ProviderContext struct {
	core.Context
	// contains filtered or unexported fields
}

func GetProviderContext

func GetProviderContext(ctx context.Context) *ProviderContext

GetProviderContext returns the *reverse.ProviderContext bound to the context.

func NewProviderContext

func NewProviderContext(client *core.Client, method core.Method) *ProviderContext

func (*ProviderContext) Client

func (c *ProviderContext) Client() *core.Client

func (*ProviderContext) Clone

func (c *ProviderContext) Clone() core.Context

func (*ProviderContext) Method

func (c *ProviderContext) Method() core.Method

Jump to

Keyboard shortcuts

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