adapter

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 2 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 interface {
	SetDialer(dialer DialerFunc)
	SetRPCServer(address string) error
	CallWithConn(conn io.ReadWriteCloser, serviceMethod string, args any, reply any) error
	Call(serviceMethod string, args any, reply any) error
	io.Closer
}

type DialerFunc

type DialerFunc func() (io.ReadWriteCloser, error)

type Request added in v1.0.2

type Request struct {
	ServiceMethod string   // format: "Service.Method"
	Seq           uint64   // sequence number chosen by client
	Next          *Request // for free list in Server
}

Request is a header written before every RPC call. It is used internally but documented here as an aid to debugging, such as when analyzing network traffic.

type Response added in v1.0.2

type Response struct {
	ServiceMethod string    // echoes that of the Request
	Seq           uint64    // echoes that of the request
	Error         string    // error, if any.
	Next          *Response // for free list in Server
}

Response is a header written before every RPC return. It is used internally but documented here as an aid to debugging, such as when analyzing network traffic.

type Server

type Server interface {
	AddCert(cert []byte)
	Accept(lis net.Listener)
	Register(rcvr any) error
	RegisterName(name string, rcvr any) error
	ServeCodec(codec ServerCodec)
	ServeConn(conn io.ReadWriteCloser)
	ServeRequest(codec ServerCodec) error
}

type ServerCodec added in v1.0.2

type ServerCodec interface {
	ReadRequestHeader(*Request) error
	ReadRequestBody(any) error
	WriteResponse(*Response, any) error

	// Close can be called multiple times and must be idempotent.
	Close() error
}

type ServerFinalizer added in v1.0.2

type ServerFinalizer func(err error, methodName string, args, reply any)

type ServerMiddleware added in v1.0.2

type ServerMiddleware func(methodName string, args any) error

type Storage

type Storage interface {
	Store(id string, info []byte) error
	ForEach(func(id string, info []byte) bool) error
	Get(id string) (info []byte, err error)
	Delete(id string) error
	Close()
}

Jump to

Keyboard shortcuts

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