batch_requests

package
v0.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultURI = "/apisix/batch-requests"
)

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(dispatcher http.Handler) http.Handler

func NewHandlerFromMetadata

func NewHandlerFromMetadata(dispatcher http.Handler, view runtime.MetadataView) (http.Handler, error)

func NewHandlerWithLimits

func NewHandlerWithLimits(dispatcher http.Handler, limits Limits) http.Handler

func WithDispatchLeaseFactory

func WithDispatchLeaseFactory(r *http.Request, factory DispatchLeaseFactory) *http.Request

WithDispatchLeaseFactory attaches a generation-aware subrequest factory to the request context without exposing the context key to other packages.

Types

type Config

type Config struct{}

type DispatchLease

type DispatchLease struct {
	Handler http.Handler
	Release func()
}

DispatchLease keeps a route generation alive while a batch subrequest is executing through the server request boundary.

type DispatchLeaseFactory

type DispatchLeaseFactory func() (DispatchLease, bool)

DispatchLeaseFactory acquires a dispatch lease for one batch worker. The factory must increment the generation reference before returning and its lease release must be idempotent.

func DispatchLeaseFactoryFromRequest

func DispatchLeaseFactoryFromRequest(r *http.Request) DispatchLeaseFactory

DispatchLeaseFactoryFromRequest returns the generation-aware subrequest factory attached by the server boundary, if any.

type ErrorResponse

type ErrorResponse struct {
	ErrorMessage string `json:"error_msg"`
}

type Limits

type Limits struct {
	MaxBodySize      int64 `json:"max_body_size,omitempty"`
	MaxPipelineItems int   `json:"max_pipeline_items,omitempty"`
	// contains filtered or unexported fields
}

type PipelineRequest

type PipelineRequest struct {
	Version   float64           `json:"version,omitempty"`
	Method    string            `json:"method,omitempty"`
	Path      string            `json:"path"`
	Query     QueryValues       `json:"query,omitempty"`
	Headers   map[string]string `json:"headers,omitempty"`
	Body      string            `json:"body,omitempty"`
	SSLVerify bool              `json:"ssl_verify,omitempty"`
}

type PipelineResponse

type PipelineResponse struct {
	Status  int            `json:"status"`
	Reason  string         `json:"reason"`
	Headers map[string]any `json:"headers,omitempty"`
	Body    string         `json:"body,omitempty"`
}

type Plugin

type Plugin struct {
	base.BasePlugin
	// contains filtered or unexported fields
}

func (*Plugin) Config

func (p *Plugin) Config() any

func (*Plugin) Handler

func (p *Plugin) Handler(next http.Handler) http.Handler

func (*Plugin) Init

func (p *Plugin) Init() error

func (*Plugin) PostInit

func (p *Plugin) PostInit() error

type QueryValues

type QueryValues map[string][]string

QueryValues retains repeated arguments while accepting APISIX's scalar string shorthand on the JSON boundary.

func (*QueryValues) UnmarshalJSON

func (values *QueryValues) UnmarshalJSON(data []byte) error

type Request

type Request struct {
	Query    QueryValues       `json:"query,omitempty"`
	Headers  map[string]string `json:"headers,omitempty"`
	Timeout  *int              `json:"timeout,omitempty"`
	Pipeline []PipelineRequest `json:"pipeline"`
}

Jump to

Keyboard shortcuts

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