Documentation ¶
Index ¶
- Variables
- func GetComponent[C Component](ctx context.Context, name string) (c C, has bool)
- func Handler(endpoints Endpoints) transports.MuxHandler
- func HashRequest(r Request, options ...HashRequestOption) (p []byte, err error)
- func LoadComponent[C Component](ctx context.Context, service []byte, name string) (c C, has bool)
- func MarkDeprecated(ctx context.Context)
- func ReleaseRequest(r Request)
- func TryLoadRequestHash(ctx context.Context) (p []byte, has bool)
- func ValueOfParam[T any](param Param) (v T, err error)
- func ValueOfResponse[T any](response Response) (v T, err error)
- func WithComponents(ctx context.Context, service []byte, components Components)
- type Abstract
- func (abstract *Abstract) AddFunction(fn Fn)
- func (abstract *Abstract) Components() (components Components)
- func (abstract *Abstract) Construct(options Options) (err error)
- func (abstract *Abstract) Document() (document documents.Endpoint)
- func (abstract *Abstract) Functions() (functions Fns)
- func (abstract *Abstract) Id() string
- func (abstract *Abstract) Internal() (internal bool)
- func (abstract *Abstract) Log() (log logs.Logger)
- func (abstract *Abstract) Name() (name string)
- func (abstract *Abstract) Shutdown(ctx context.Context)
- func (abstract *Abstract) Version() versions.Version
- type Component
- type Components
- type Config
- type Empty
- type Endpoint
- type EndpointGetOption
- type EndpointGetOptions
- type EndpointInfo
- type EndpointInfos
- type Endpoints
- type EndpointsManager
- type Fn
- type FnInfo
- type FnInfos
- type FnTask
- type Fns
- type HashRequestOption
- type HashRequestOptions
- type Header
- func (header Header) AcceptedVersions() versions.Intervals
- func (header Header) DeviceId() []byte
- func (header Header) DeviceIp() []byte
- func (header Header) EndpointId() []byte
- func (header Header) Internal() bool
- func (header Header) ProcessId() []byte
- func (header Header) RequestId() []byte
- func (header Header) Token() []byte
- type Listenable
- type Manager
- func (manager *Manager) Add(service Service) (err error)
- func (manager *Manager) Get(_ context.Context, name []byte, options ...EndpointGetOption) (endpoint Endpoint, has bool)
- func (manager *Manager) Info() (infos EndpointInfos)
- func (manager *Manager) Listen(ctx context.Context) (err error)
- func (manager *Manager) Request(ctx context.Context, name []byte, fn []byte, param interface{}, ...) (response Response, err error)
- func (manager *Manager) RequestAsync(ctx context.Context, name []byte, fn []byte, param any, ...) (future futures.Future, err error)
- func (manager *Manager) Shutdown(ctx context.Context)
- type Middleware
- type MuxHandler
- type Options
- type Param
- type Request
- func AcquireRequest(ctx context.Context, service []byte, fn []byte, param interface{}, ...) (v Request)
- func LoadRequest(ctx context.Context) Request
- func NewRequest(ctx context.Context, service []byte, fn []byte, param interface{}, ...) (v Request)
- func TryLoadRequest(ctx context.Context) (r Request, ok bool)
- type RequestOption
- func WithDeviceId(id []byte) RequestOption
- func WithDeviceIp(ip []byte) RequestOption
- func WithEndpointId(id []byte) RequestOption
- func WithInternalRequest() RequestOption
- func WithProcessId(id []byte) RequestOption
- func WithRequestId(id []byte) RequestOption
- func WithRequestVersions(acceptedVersions versions.Intervals) RequestOption
- func WithToken(token []byte) RequestOption
- type RequestOptions
- type Response
- type Service
- type Services
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDeviceId = errors.NotAcceptable("fns: X-Fns-Device-Id is required") ErrInvalidPath = errors.Warning("fns: invalid path") ErrInvalidBody = errors.Warning("fns: invalid body") ErrInvalidRequestVersions = errors.Warning("fns: invalid request versions") )
View Source
var (
EmptyBytes []byte
)
Functions ¶
func GetComponent ¶ added in v1.3.0
func Handler ¶
func Handler(endpoints Endpoints) transports.MuxHandler
func HashRequest ¶
func HashRequest(r Request, options ...HashRequestOption) (p []byte, err error)
func LoadComponent ¶
func MarkDeprecated ¶ added in v1.2.60
func ReleaseRequest ¶
func ReleaseRequest(r Request)
func TryLoadRequestHash ¶ added in v1.2.0
func ValueOfParam ¶ added in v1.2.0
ValueOfParam type of T must be struct value or slice, can not be ptr
func ValueOfResponse ¶ added in v1.2.0
ValueOfResponse type of T must be struct value or slice, can not be ptr
func WithComponents ¶
func WithComponents(ctx context.Context, service []byte, components Components)
Types ¶
type Abstract ¶
type Abstract struct {
// contains filtered or unexported fields
}
func (*Abstract) AddFunction ¶
func (*Abstract) Components ¶
func (abstract *Abstract) Components() (components Components)
type Components ¶
type Components []Component
func LoadComponents ¶
func LoadComponents(ctx context.Context, service []byte) Components
type Config ¶
type Config map[string]json.RawMessage
type Empty ¶
type Empty struct{}
Empty @name Empty @description Empty object
func (Empty) MarshalJSON ¶ added in v1.2.0
type EndpointGetOption ¶
type EndpointGetOption func(options *EndpointGetOptions)
func EndpointId ¶
func EndpointId(id []byte) EndpointGetOption
func EndpointVersions ¶
func EndpointVersions(requestVersions versions.Intervals) EndpointGetOption
type EndpointGetOptions ¶
type EndpointGetOptions struct {
// contains filtered or unexported fields
}
func (EndpointGetOptions) Id ¶
func (options EndpointGetOptions) Id() []byte
func (EndpointGetOptions) Versions ¶
func (options EndpointGetOptions) Versions() versions.Intervals
type EndpointInfo ¶
type EndpointInfos ¶
type EndpointInfos []EndpointInfo
func (EndpointInfos) Find ¶
func (infos EndpointInfos) Find(name []byte) (info EndpointInfo, found bool)
func (EndpointInfos) Len ¶
func (infos EndpointInfos) Len() int
func (EndpointInfos) Less ¶
func (infos EndpointInfos) Less(i, j int) bool
func (EndpointInfos) Swap ¶
func (infos EndpointInfos) Swap(i, j int)
type Endpoints ¶
type Endpoints interface { Info() (infos EndpointInfos) Get(ctx context.Context, name []byte, options ...EndpointGetOption) (endpoint Endpoint, has bool) RequestAsync(ctx context.Context, name []byte, fn []byte, param any, options ...RequestOption) (future futures.Future, err error) Request(ctx context.Context, name []byte, fn []byte, param any, options ...RequestOption) (response Response, err error) }
type EndpointsManager ¶
type HashRequestOption ¶
type HashRequestOption func(options *HashRequestOptions)
func HashRequestBySumFn ¶
func HashRequestBySumFn(fn func(p []byte) uint64) HashRequestOption
func HashRequestWithDeviceId ¶
func HashRequestWithDeviceId() HashRequestOption
func HashRequestWithToken ¶
func HashRequestWithToken() HashRequestOption
type HashRequestOptions ¶
type HashRequestOptions struct {
// contains filtered or unexported fields
}
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
func (Header) AcceptedVersions ¶
func (Header) EndpointId ¶
type Listenable ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) Info ¶
func (manager *Manager) Info() (infos EndpointInfos)
func (*Manager) RequestAsync ¶ added in v1.2.34
type Middleware ¶ added in v1.1.3
type Middleware interface { transports.Middleware Services() []Service }
type MuxHandler ¶ added in v1.1.3
type MuxHandler interface { transports.MuxHandler Services() []Service }
type Request ¶
type Request interface { context.Context Fn() (endpoint []byte, fn []byte) Header() (header Header) Param() (param Param) }
func AcquireRequest ¶
func LoadRequest ¶
func NewRequest ¶ added in v1.2.34
type RequestOption ¶
type RequestOption func(*RequestOptions)
func WithDeviceId ¶
func WithDeviceId(id []byte) RequestOption
func WithDeviceIp ¶
func WithDeviceIp(ip []byte) RequestOption
func WithEndpointId ¶
func WithEndpointId(id []byte) RequestOption
func WithInternalRequest ¶
func WithInternalRequest() RequestOption
func WithProcessId ¶
func WithProcessId(id []byte) RequestOption
func WithRequestId ¶
func WithRequestId(id []byte) RequestOption
func WithRequestVersions ¶
func WithRequestVersions(acceptedVersions versions.Intervals) RequestOption
func WithToken ¶
func WithToken(token []byte) RequestOption
type RequestOptions ¶
type RequestOptions struct {
// contains filtered or unexported fields
}
type Response ¶
func NewResponse ¶
type Service ¶
type Service interface { Endpoint Construct(options Options) (err error) Components() (components Components) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.