client

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// export to custom need save function
	Storage adapter.Storage
	// export to custom need save function
	Deleted atomic.Bool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(rpc adapter.Client, opts ...Options) *Client

func (*Client) Call

func (c *Client) Call(serviceMethod string, args any, reply any, finalizer ...queue.Finalizer) error

func (*Client) CallAsync

func (c *Client) CallAsync(serviceMethod string, args any, reply any, finalizer ...queue.Finalizer) error

func (*Client) CallAsyncOnce

func (c *Client) CallAsyncOnce(serviceMethod string, args any, reply any, finalizer ...queue.Finalizer) error

func (*Client) CallOnce

func (c *Client) CallOnce(serviceMethod string, args any, reply any, finalizer ...queue.Finalizer) error

func (*Client) CallWithConn

func (c *Client) CallWithConn(conn io.ReadWriteCloser, serviceMethod string, args any, reply any, finalizer ...queue.Finalizer) error

func (*Client) Close

func (c *Client) Close(isDeleted ...bool) error

func (*Client) DoRecoverJob added in v1.0.5

func (c *Client) DoRecoverJob()

export to user control

func (*Client) Save

func (c *Client) Save(runMethod RunMethod, serviceMethod string, args any) queue.Finalizer

type Job

type Job struct {
	// task id
	ID        string
	RunMethod RunMethod
	Method    string
	Args      map[string]any
}

type Middleware

type Middleware func(task queue.Task, serviceMethod string, args any, reply any)

type NeedSave

type NeedSave func(bool, *Client, queue.Task) bool

func DefaultSave

func DefaultSave() NeedSave

type Options

type Options func(*Client)

func DisableRetry

func DisableRetry() Options

func EnableNonBlocking

func EnableNonBlocking() Options

func WithFinalizer

func WithFinalizer(f queue.Finalizer) Options

func WithMiddleware

func WithMiddleware(m Middleware) Options

func WithSaveCondition

func WithSaveCondition(f NeedSave) Options

func WithStorage

func WithStorage(storage adapter.Storage) Options

func WithWorker

func WithWorker(w *worker.Worker) Options

type RunMethod

type RunMethod int
const (
	SYNC RunMethod = iota
	ASYNC
	ONCE
	ASYNC_ONCE
)

Jump to

Keyboard shortcuts

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