hostservices

package
v0.0.0-...-fe15b9e Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostService

type HostService interface {
	Initialize(json.RawMessage) error

	HandleRequest(
		connection *nats.Conn,
		namespace string,
		workloadId string,
		method string,
		workloadName string,
		metadata map[string]string,
		request []byte,
	) (ServiceResult, error)
}

type HostServicesClient

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

func NewHostServicesClient

func NewHostServicesClient(ncInternal *nats.Conn, timeout time.Duration, namespace, workloadName, workloadId string) *HostServicesClient

func (*HostServicesClient) PerformRPC

func (c *HostServicesClient) PerformRPC(ctx context.Context, service string, method string, payload []byte, metadata map[string]string) (ServiceResult, error)

type HostServicesServer

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

func NewHostServicesServer

func NewHostServicesServer(ncInternal *nats.Conn, log *slog.Logger, tracer trace.Tracer) *HostServicesServer

func (*HostServicesServer) AddService

func (h *HostServicesServer) AddService(name string, svc HostService, config json.RawMessage) error

func (*HostServicesServer) RemoveHostServicesConnection

func (h *HostServicesServer) RemoveHostServicesConnection(workloadId string)

func (*HostServicesServer) Services

func (h *HostServicesServer) Services() []string

func (*HostServicesServer) SetHostServicesConnection

func (h *HostServicesServer) SetHostServicesConnection(workloadId string, nc *nats.Conn)

func (*HostServicesServer) Start

func (h *HostServicesServer) Start() error

Host services server instances subscribe to the following `hostint.>` subjects, which are exported by the `nexnode` account on the configured internal NATS connection for consumption by agents:

- hostint.<agent_id>.rpc.<namespace>.<workloadName>.<service>.<method>

type ServiceResult

type ServiceResult struct {
	Code    uint
	Message string
	Data    []byte
}

func ServiceResultFail

func ServiceResultFail(code uint, message string) ServiceResult

func ServiceResultPass

func ServiceResultPass(code uint, message string, data []byte) ServiceResult

func (ServiceResult) Error

func (r ServiceResult) Error() error

func (ServiceResult) IsError

func (r ServiceResult) IsError() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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