proxy

package
v1.2.2-rc3 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComputeEndpointSubjectPrefix = "node.compute"
	CallbackSubjectPrefix        = "node.orchestrator"

	AskForBid       = "AskForBid/v1"
	BidAccepted     = "BidAccepted/v1"
	BidRejected     = "BidRejected/v1"
	CancelExecution = "CancelExecution/v1"
	ExecutionLogs   = "ExecutionLogs/v1"

	OnBidComplete    = "OnBidComplete/v1"
	OnRunComplete    = "OnRunComplete/v1"
	OnCancelComplete = "OnCancelComplete/v1"
	OnComputeFailure = "OnComputeFailure/v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseRequest added in v1.2.2

type BaseRequest[T any] struct {
	TargetNodeID string
	Method       string
	Body         T
}

func (*BaseRequest[T]) ComputeEndpoint added in v1.2.2

func (r *BaseRequest[T]) ComputeEndpoint() string

ComputeEndpoint return the compute endpoint for the base request.

func (*BaseRequest[T]) OrchestratorEndpoint added in v1.2.2

func (r *BaseRequest[T]) OrchestratorEndpoint() string

OrchestratorEndpoint return the orchestrator endpoint for the base request.

type CallbackHandler

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

CallbackHandler is a handler for callback events that registers for incoming nats requests to Bacalhau callback protocol, and delegates the handling of the request to the provided callback.

func NewCallbackHandler

func NewCallbackHandler(params CallbackHandlerParams) (*CallbackHandler, error)

type CallbackHandlerParams

type CallbackHandlerParams struct {
	Name     string
	Conn     *nats.Conn
	Callback compute.Callback
}

type CallbackProxy

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

CallbackProxy is a proxy for a compute.Callback that can be used to send compute callbacks to the requester node, such as when the execution is completed or when a failure occurs. The proxy can forward callbacks to a remote requester node, or locally if the node is the requester and a LocalCallback is provided.

func NewCallbackProxy

func NewCallbackProxy(params CallbackProxyParams) *CallbackProxy

func (*CallbackProxy) OnBidComplete

func (p *CallbackProxy) OnBidComplete(ctx context.Context, result compute.BidResult)

func (*CallbackProxy) OnCancelComplete

func (p *CallbackProxy) OnCancelComplete(ctx context.Context, result compute.CancelResult)

func (*CallbackProxy) OnComputeFailure

func (p *CallbackProxy) OnComputeFailure(ctx context.Context, result compute.ComputeError)

func (*CallbackProxy) OnRunComplete

func (p *CallbackProxy) OnRunComplete(ctx context.Context, result compute.RunResult)

type CallbackProxyParams

type CallbackProxyParams struct {
	Conn *nats.Conn
}

type ComputeHandler

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

ComputeHandler handles NATS messages for compute operations.

func NewComputeHandler

func NewComputeHandler(params ComputeHandlerParams) (*ComputeHandler, error)

NewComputeHandler creates a new ComputeHandler.

type ComputeHandlerParams

type ComputeHandlerParams struct {
	Name            string
	Conn            *nats.Conn
	ComputeEndpoint compute.Endpoint
}

ComputeHandlerParams defines parameters for creating a new ComputeHandler.

type ComputeProxy

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

ComputeProxy is a proxy to a compute node endpoint that will forward requests to remote compute nodes, or to a local compute node if the target peer ID is the same as the local host, and a LocalEndpoint implementation is provided.

func NewComputeProxy

func NewComputeProxy(params ComputeProxyParams) (*ComputeProxy, error)

func (*ComputeProxy) AskForBid

func (*ComputeProxy) BidAccepted

func (*ComputeProxy) BidRejected

func (*ComputeProxy) CancelExecution

func (*ComputeProxy) ExecutionLogs

type ComputeProxyParams

type ComputeProxyParams struct {
	Conn *nats.Conn
}

Jump to

Keyboard shortcuts

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