realtime

package
v0.0.0-...-350b75a Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsyncInvoke

func AsyncInvoke(functionName string, id string) error

func FastAsyncInvoke

func FastAsyncInvoke(next http.HandlerFunc, r *http.Request) error

Bypassing queue worker

func Invoke

func Invoke(next http.HandlerFunc, w http.ResponseWriter, r *http.Request) error

Invoke execute a deployed function

func MakeQueuedProxy

func MakeQueuedProxy(metrics metrics.MetricOptions, wildcard bool, canQueueRequests queue.CanQueueRequests, pathTransformer handlers.URLPathTransformer) http.HandlerFunc

MakeQueuedProxy accepts work onto a queue

func MakeRealtimeAsyncInvokeHandler

func MakeRealtimeAsyncInvokeHandler(next http.HandlerFunc) http.HandlerFunc

func MakeRealtimeDeleteHandler

func MakeRealtimeDeleteHandler(
	ac AdmissionControl,
	proxy *types.HTTPClientReverseProxy,
	notifiers []handlers.HTTPNotifier,
	baseURLResolver handlers.BaseURLResolver,
	urlPathTransformer handlers.URLPathTransformer) http.HandlerFunc

Forward the delete request to the backend.

func MakeRealtimeDeployHandler

func MakeRealtimeDeployHandler(
	ac AdmissionControl,
	proxy *types.HTTPClientReverseProxy,
	notifiers []handlers.HTTPNotifier,
	baseURLResolver handlers.BaseURLResolver,
	urlPathTransformer handlers.URLPathTransformer) http.HandlerFunc

Forward the deploy request to the backend.

func MakeRealtimeInvokeHandler

func MakeRealtimeInvokeHandler(next http.HandlerFunc) http.HandlerFunc

func MakeRealtimeUpdateHandler

func MakeRealtimeUpdateHandler(
	ac AdmissionControl,
	proxy *types.HTTPClientReverseProxy,
	notifiers []handlers.HTTPNotifier,
	baseURLResolver handlers.BaseURLResolver,
	urlPathTransformer handlers.URLPathTransformer) http.HandlerFunc

Forward the update request to the backend.

func RemoveFunctionHandler

func RemoveFunctionHandler(functionName string)

func SetFunctionHandler

func SetFunctionHandler(f requests.CreateFunctionRequest)

SetFunctionHandler create handler for a new function or update an existing one

Types

type AdmissionControl

type AdmissionControl interface {
	Register(
		w http.ResponseWriter,
		r *http.Request,
		proxyClient *http.Client,
		baseURL string,
		requestURL string,
		timeout time.Duration,
		writeRequestURI bool) (int, error)
	Update(
		w http.ResponseWriter,
		r *http.Request,
		proxyClient *http.Client,
		baseURL string,
		requestURL string,
		timeout time.Duration,
		writeRequestURI bool) (int, error)
	Unregister(
		w http.ResponseWriter,
		r *http.Request,
		proxyClient *http.Client,
		baseURL string,
		requestURL string,
		timeout time.Duration,
		writeRequestURI bool) (int, error)
}

type Invocation

type Invocation struct {
	// contains filtered or unexported fields
}

Invocation holds information of pending requests

type InvocationHandler

type InvocationHandler struct {
	// Channel for pending invocations
	SyncInvs  chan Invocation
	AsyncInvs chan Invocation
	Realtime  float64
	AsyncWait sync.Map
	//FreeAsync int32
	Timing     *time.Ticker
	Stop       chan bool
	Update     chan bool
	BufferSize int
	Idle       chan bool
	AvailSlots chan int
}

InvocationHandler process new invocations

type ReserveAdmissionControl

type ReserveAdmissionControl struct {
}

func (ReserveAdmissionControl) Register

func (ac ReserveAdmissionControl) Register(
	w http.ResponseWriter,
	r *http.Request,
	proxyClient *http.Client,
	baseURL string,
	requestURL string,
	timeout time.Duration,
	writeRequestURI bool) (int, error)

func (ReserveAdmissionControl) Unregister

func (ac ReserveAdmissionControl) Unregister(
	w http.ResponseWriter,
	r *http.Request,
	proxyClient *http.Client,
	baseURL string,
	requestURL string,
	timeout time.Duration,
	writeRequestURI bool) (int, error)

func (ReserveAdmissionControl) Update

func (ac ReserveAdmissionControl) Update(
	w http.ResponseWriter,
	r *http.Request,
	proxyClient *http.Client,
	baseURL string,
	requestURL string,
	timeout time.Duration,
	writeRequestURI bool) (int, error)

type ResourceManager

type ResourceManager struct{}

func (ResourceManager) CreateImage

func (rm ResourceManager) CreateImage(
	r *http.Request,
	proxyClient *http.Client,
	baseURL string,
	requestURL string,
	timeout time.Duration,
	writeRequestURI bool) (*http.Response, error)

func (ResourceManager) GetAvailReplicas

func (rm ResourceManager) GetAvailReplicas(functionName string) (uint64, error)

Check if available replicas meet expect ones

func (ResourceManager) GetCPUQuantity

func (rm ResourceManager) GetCPUQuantity(str string) (int64, error)

GetCPUQuantity returns CPU quantity as number

func (ResourceManager) GetDeploymentParams

func (rm ResourceManager) GetDeploymentParams(functionName string) (scaling.ServiceQueryResponse, error)

GetDeploymentParams returns deployment params of a registered function

func (ResourceManager) GetMemoryQuantity

func (rm ResourceManager) GetMemoryQuantity(str string) (int64, error)

GetMemoryQuantity returns memory quantity as number

func (ResourceManager) GetResourceQuantity

func (rm ResourceManager) GetResourceQuantity(req requests.FunctionResources) (int64, int64, error)

func (ResourceManager) PackageRequest

func (rm ResourceManager) PackageRequest(cfr requests.CreateFunctionRequest, req *http.Request) error

PackageRequest reformats the request into the form understandable by the underlying system and write to the http request

func (ResourceManager) ParseRequest

ParseRequest returns a CreateFunctionRequest that hold all needed information about function deployment/update

func (ResourceManager) RemoveImage

func (rm ResourceManager) RemoveImage(
	r *http.Request,
	proxyClient *http.Client,
	baseURL string,
	requestURL string,
	timeout time.Duration,
	writeRequestURI bool) (*http.Response, error)

func (ResourceManager) Scale

func (rm ResourceManager) Scale(functionName string, realtimeReplicas uint64) error

Scale a function by either increasing or decreasing its replicas

func (ResourceManager) SetSandboxResources

func (rm ResourceManager) SetSandboxResources(request *requests.CreateFunctionRequest, cpu int64, memory int64)

Reserve resource for realtime deployment

func (ResourceManager) UpdateImage

func (rm ResourceManager) UpdateImage(
	r *http.Request,
	proxyClient *http.Client,
	baseURL string,
	requestURL string,
	timeout time.Duration,
	writeRequestURI bool) (*http.Response, error)

func (ResourceManager) WaitForAvailReplicas

func (rm ResourceManager) WaitForAvailReplicas(
	functionName string,
	expectedReplicas uint64,
	retry uint64,
	interval int) bool

Wait until a given function has sufficient replicas or timeout determined by retry*interval

Jump to

Keyboard shortcuts

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