rpc

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PARSE_ERROR      = -32700
	INVALID_REQUEST  = -32600
	METHOD_NOT_FOUND = -32601
	INVALID_PARAMS   = -32602
	INTERNAL_ERROR   = -32603
)

Variables

This section is empty.

Functions

func DecodeMessage

func DecodeMessage[T any](msg []byte) (*T, []byte, error)

DecodeMessage gets the content of the message as deserializable JSON, and the method type from a standard PMSP client message.

func JRPCRes

func JRPCRes(bytes []byte) []byte

JRPCRes allows

func SplitFunc

func SplitFunc(data []byte, atEOF bool) (advance int, token []byte, err error)

SplitFunc allows to use a scanner to parse the JRPCRequest

Types

type CancelationReq

type CancelationReq struct {
	JRPCRequest
	Params CancelationReqParams `json:"params"`
}

type CancelationReqParams

type CancelationReqParams struct {
	PipelineId             string `json:"pipeline-id"`        // Unique identifier of the pipeline to cancel
	PipeLineLifetimeSecret string `json:"pipeline-lt-secret"` // Secret ensuring the process has the rights to perform cancelation
}

type CustomJRPCRequest

type CustomJRPCRequest struct {
	JRPCRequest
	Params map[string]any
}

type ErrorData

type ErrorData struct {
	Code    int16       `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

ErrorData is the Response interface for whenever it encounters an error

type GetPipelinesReq

type GetPipelinesReq struct {
	JRPCRequest
	Params ListPipelinesParams `json:"params"`
}

type GetReportsParams

type GetReportsParams struct {
	PipelineId    *string  `json:"pipeline-id"`    // To specify if you want the reports of a single run of a pipeline
	PipelineName  *string  `json:"pipeline-name"`  // To specify if you want all the reports of a named pipeline
	Type          string   `json:"type"`           // Specify the report type
	Fields        []string `json:"fields"`         // To specify if you only want some fields of the pipeline.
	OmittedFields []string `json:"omitted-fields"` // To specify if you want every info except one
}

type GetReportsReq

type GetReportsReq struct {
	JRPCRequest
	Params GetReportsParams
}

type JRPCError

type JRPCError struct {
	JRPCResponse
	Error ErrorData `json:"error"`
}

Error type for JRPC Response

func NewError

func NewError(reqId *int, err ErrorData) JRPCError

NewError helps build a standardized JRPC error response

type JRPCRequest

type JRPCRequest struct {
	JsonRpcVersion string `json:"jsonprc"`
	Id             int    `json:"id"`
	Method         string `json:"method"`
}

Received structure to decode in JSON

type JRPCResponse

type JRPCResponse struct {
	RPC string `json:"jsonrpc"`
	ID  *int   `json:"id"`
}

Response sent by the server to the client after receiving a JRPCRequest

type JRPCSuccess

type JRPCSuccess[T any] struct {
	JRPCResponse
	Value T `json:"value"`
}

func NewResult

func NewResult[T any](reqId int, value T) JRPCSuccess[T]

NewResult helps build a standardized JRPC success response

type ListPipelinesParams

type ListPipelinesParams struct {
	Id     *string `json:"id,omitempty"` // Id if the pipeline to list. If not present, return every pipeline
	Active bool    `json:"active"`       // To know if the pipeline to search is a running process
	All    bool    `json:"all"`          // tells if we need to see every pipeline
}

ListPipelinesParams list request options to get a json representation of a / multiple pipelines

type SimpleMessage

type SimpleMessage struct {
	Message string `json:"message"`
}

type StartPipelineParams

type StartPipelineParams struct {
	Name string
}

type StartPipelineReq

type StartPipelineReq struct {
	JRPCRequest
	Params StartPipelineParams `json:"params"`
}

type TerminationReq

type TerminationReq struct {
}

Jump to

Keyboard shortcuts

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