grpc

package
v0.10.25 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScanInvalid

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

ScanInvalid implements bufio.SplitFunc for bufio.Scanner, it reads up to 0xFF (invalid unicode) or EOF and returns read data without 0xFF.

Types

type AuthorizeHandler

type AuthorizeHandler interface {
	// Handle takes AuthorizeInput as a field resolution input and returns arbitrary
	// user response.
	Handle(input driver.AuthorizeInput) (bool, error)
}

AuthorizeHandler interface implemented by user to handle field resolution request.

type AuthorizeHandlerFunc

type AuthorizeHandlerFunc func(input driver.AuthorizeInput) (bool, error)

AuthorizeHandlerFunc is a convienience function wrapper implementing AuthorizeHandler

func (AuthorizeHandlerFunc) Handle

Handle takes AuthorizeInput as a field resolution input and returns arbitrary

type Client

type Client struct {
	Client protoDriverService.DriverClient
}

Client for github.com/graphql-editor/stucco/pkg/proto

func (*Client) Authorize

func (m *Client) Authorize(input driver.AuthorizeInput) (f driver.AuthorizeOutput)

Authorize marshals a field resolution request through GRPC to a function that handles an actual resolution.

func (*Client) FieldResolve

func (m *Client) FieldResolve(input driver.FieldResolveInput) (f driver.FieldResolveOutput)

FieldResolve marshals a field resolution request through GRPC to a function that handles an actual resolution.

func (*Client) InterfaceResolveType

func (m *Client) InterfaceResolveType(input driver.InterfaceResolveTypeInput) (i driver.InterfaceResolveTypeOutput)

InterfaceResolveType handles type resolution for interface through GRPC

func (*Client) ScalarParse

func (m *Client) ScalarParse(input driver.ScalarParseInput) (s driver.ScalarParseOutput)

ScalarParse executes server side ScalarParse rpc

func (*Client) ScalarSerialize

func (m *Client) ScalarSerialize(input driver.ScalarSerializeInput) (s driver.ScalarSerializeOutput)

ScalarSerialize executes server side ScalarSerialize rpc

func (*Client) SetSecrets

func (m *Client) SetSecrets(input driver.SetSecretsInput) driver.SetSecretsOutput

SetSecrets sets a marshals secrets through GRPC

func (*Client) Stderr

func (m *Client) Stderr(ctx context.Context, name string) error

Stderr opens a byte stream between from server to client and logs results using k8s.io/klog

Checks if byte stream is valid json with property level set to warn or err and logs the contents of message property from json. Otherwise if byte stream has prefix [WARN] or [ERROR] logs the contents of stream to matching klog Severity. If not matched, logs the whole byte stream unmodified to Error severity.

func (*Client) Stdout

func (m *Client) Stdout(ctx context.Context, name string) error

Stdout opens a byte stream between from server to client and logs results using k8s.io/klog

Checks if byte stream is valid json with property level set to info or debug and logs the contents of message property from json. Otherwise if byte stream has prefix [INFO] or [DEBUG] logs the contents of stream to matching verbosity level without prefix. If not matched, logs the whole byte stream unmodified with debug verbosity.

Info verbosity is 3 Debug verbosity is 5

func (*Client) Stream

func (m *Client) Stream(input driver.StreamInput) (s driver.StreamOutput)

Stream TODO: client side stream requests

func (*Client) SubscriptionConnection

func (m *Client) SubscriptionConnection(input driver.SubscriptionConnectionInput) (f driver.SubscriptionConnectionOutput)

SubscriptionConnection marshals a field resolution request through GRPC to a function that handles an actual resolution.

func (*Client) SubscriptionListen

func (m *Client) SubscriptionListen(input driver.SubscriptionListenInput) (out driver.SubscriptionListenOutput)

SubscriptionListen returns a subscription event reader.

func (*Client) UnionResolveType

func (m *Client) UnionResolveType(input driver.UnionResolveTypeInput) (f driver.UnionResolveTypeOutput)

UnionResolveType Implements driver.Driver

type FieldResolveHandler

type FieldResolveHandler interface {
	// Handle takes FieldResolveInput as a field resolution input and returns arbitrary
	// user response.
	Handle(input driver.FieldResolveInput) (interface{}, error)
}

FieldResolveHandler interface implemented by user to handle field resolution request.

type FieldResolveHandlerFunc

type FieldResolveHandlerFunc func(input driver.FieldResolveInput) (interface{}, error)

FieldResolveHandlerFunc is a convienience function wrapper implementing FieldResolveHandler

func (FieldResolveHandlerFunc) Handle

func (f FieldResolveHandlerFunc) Handle(input driver.FieldResolveInput) (interface{}, error)

Handle takes FieldResolveInput as a field resolution input and returns arbitrary

type InterfaceResolveTypeHandler

type InterfaceResolveTypeHandler interface {
	// Handle takes InterfaceResolveTypeInput as a type resolution input and returns
	// type name.
	Handle(driver.InterfaceResolveTypeInput) (string, error)
}

InterfaceResolveTypeHandler interface implemented by user to handle interface type resolution

type InterfaceResolveTypeHandlerFunc

type InterfaceResolveTypeHandlerFunc func(driver.InterfaceResolveTypeInput) (string, error)

InterfaceResolveTypeHandlerFunc is a convienience function wrapper implementing InterfaceResolveTypeHandler

func (InterfaceResolveTypeHandlerFunc) Handle

Handle takes InterfaceResolveTypeInput as a type resolution input and returns type name.

type PipeStderr

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

PipeStderr adds a hook to os.Stderr, watching all writes done to os.Stderr. Writes both written to os.Stderr and to GRPC ByteStream.

func (*PipeStderr) Close

func (p *PipeStderr) Close() error

Close cleans up after a hook. It is an error to not close a hook.

func (*PipeStderr) Handle

Handle is a blocking method that sends all Writes to os.Stderr through GRPC

func (*PipeStderr) Open

func (p *PipeStderr) Open() error

Open creates a new hook on os.Stderr. Must be called before Handle.

type PipeStdout

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

PipeStdout adds a hook to os.Stdout, watching all writes done to os.Stdout. Writes both written to os.Stdout and to GRPC ByteStream.

func (*PipeStdout) Close

func (p *PipeStdout) Close() error

Close cleans up after a hook. It is an error to not close a hook.

func (*PipeStdout) Handle

Handle is a blocking method that sends all Writes to os.Stdout through GRPC

func (*PipeStdout) Open

func (p *PipeStdout) Open() error

Open creates a new hook on os.Stdout. Must be called before Handle.

type ScalarParseHandler

type ScalarParseHandler interface {
	// Handle takes ScalarParseInput as input returning arbitrary parsed value
	Handle(driver.ScalarParseInput) (interface{}, error)
}

ScalarParseHandler interface that must be implemented by user to handle scalar parse requests

type ScalarParseHandlerFunc

type ScalarParseHandlerFunc func(driver.ScalarParseInput) (interface{}, error)

ScalarParseHandlerFunc is a convienience wrapper for function implementing ScalarParseHandler

func (ScalarParseHandlerFunc) Handle

func (f ScalarParseHandlerFunc) Handle(input driver.ScalarParseInput) (interface{}, error)

Handle implements ScalarParseHandler.Handle

type ScalarSerializeHandler

type ScalarSerializeHandler interface {
	// Handle takes ScalarSerializeInput as input returning arbitrary serialized value
	Handle(driver.ScalarSerializeInput) (interface{}, error)
}

ScalarSerializeHandler interface that must be implemented by user to handle scalar serialize requests

type ScalarSerializeHandlerFunc

type ScalarSerializeHandlerFunc func(driver.ScalarSerializeInput) (interface{}, error)

ScalarSerializeHandlerFunc is a convienience wrapper for function implementing ScalarSerializeHandler

func (ScalarSerializeHandlerFunc) Handle

func (f ScalarSerializeHandlerFunc) Handle(input driver.ScalarSerializeInput) (interface{}, error)

Handle implements ScalarSerializeHandler.Handle

type Server

type Server struct {
	protoDriverService.DriverServer
	AuthorizeHandler              AuthorizeHandler
	FieldResolveHandler           FieldResolveHandler
	InterfaceResolveTypeHandler   InterfaceResolveTypeHandler
	ScalarParseHandler            ScalarParseHandler
	ScalarSerializeHandler        ScalarSerializeHandler
	UnionResolveTypeHandler       UnionResolveTypeHandler
	SetSecretsHandler             SetSecretsHandler
	StreamHandler                 StreamHandler
	StdoutHandler                 StdoutHandler
	StderrHandler                 StderrHandler
	SubscriptionConnectionHandler SubscriptionConnectionHandler
	SubscriptionListenHandler     SubscriptionListenHandler
}

Server for github.com/graphql-editor/stucco/pkg/proto

func (*Server) Authorize

Authorize function calls user implemented handler for field resolution

func (*Server) FieldResolve

FieldResolve function calls user implemented handler for field resolution

func (*Server) InterfaceResolveType

InterfaceResolveType handles type resolution request with user defined function

func (*Server) ScalarParse

ScalarParse calls user defined function for parsing a scalar.

func (*Server) ScalarSerialize

ScalarSerialize executes user handler for scalar serialization

func (*Server) SetSecrets

SetSecrets calls user SetSecrets handler

func (*Server) Stderr

Stderr handles a stderr bytestream request for server

func (*Server) Stdout

Stdout handles a stdout bytestream request for server

func (*Server) Stream

Stream hands over stream request to user defined handler for stream

func (*Server) SubscriptionConnection

SubscriptionConnection function calls user implemented handler for subscription connection creation

func (*Server) SubscriptionListen

SubscriptionListen implements protoMessages.DriverServer

func (*Server) UnionResolveType

UnionResolveType executes union type resolution request agains user defined function

type SetSecretsHandler

type SetSecretsHandler interface {
	// Handle takes SetSecretsHandler as an input and should set a secrets on a server state. It should return nil if there was no error.
	Handle(input driver.SetSecretsInput) error
}

SetSecretsHandler interface implemented by user to handle secrets input from client.

type SetSecretsHandlerFunc

type SetSecretsHandlerFunc func(input driver.SetSecretsInput) error

SetSecretsHandlerFunc is a convienience wrapper around function to implement SetSecretsHandler

func (SetSecretsHandlerFunc) Handle

Handle takes SetSecretsInput as an input, sets a secrets state, and returns a nil if there was no error

type StderrHandler

type StderrHandler interface {
	Handle(*protoMessages.ByteStreamRequest, protoDriverService.Driver_StderrServer) error
}

StderrHandler interface that must be implemented by user for handling stderr bytestream requests by server.

type StderrHandlerFunc

StderrHandlerFunc is a type of function that must be implemented in server implementation to handle ByteStreamRequest for stderr.

func (StderrHandlerFunc) Handle

Handle for implementing StderrHandler interface

type StdoutHandler

type StdoutHandler interface {
	Handle(*protoMessages.ByteStreamRequest, protoDriverService.Driver_StdoutServer) error
}

StdoutHandler interface that must be implemented by user for handling stdout bytestream requests by server.

type StdoutHandlerFunc

StdoutHandlerFunc is a type of function that must be implemented in server implementation to handle ByteStreamRequest for stdout.

func (StdoutHandlerFunc) Handle

Handle for implementing StdoutHandler interface

type StreamHandler

type StreamHandler interface {
	// Handle handles subscription streaming requests
	Handle(*protoMessages.StreamRequest, protoDriverService.Driver_StreamServer) error
}

StreamHandler interface must be implemented by user to handle stream requests from subscriptions

type StreamHandlerFunc

StreamHandlerFunc is a convienience wrapper implementing StreamHandler interface

func (StreamHandlerFunc) Handle

Handle implements StreamHandler.Handle method

type SubscriptionConnectionHandler

type SubscriptionConnectionHandler interface {
	// Handle takes SubscriptionConnectionInput as a field resolution input and returns
	// arbitrary user response.
	Handle(input driver.SubscriptionConnectionInput) (interface{}, error)
}

SubscriptionConnectionHandler interface implemented by user to handle subscription connection creation

type SubscriptionConnectionHandlerFunc

type SubscriptionConnectionHandlerFunc func(input driver.SubscriptionConnectionInput) (interface{}, error)

SubscriptionConnectionHandlerFunc is a convienience function wrapper implementing SubscriptionConnectionHandler

func (SubscriptionConnectionHandlerFunc) Handle

Handle takes SubscriptionConnectionInput as a field resolution input and returns arbitrary

type SubscriptionListenEmitter

type SubscriptionListenEmitter interface {
	// Emit new subscription event
	Emit() error
	// Close emitter
	Close() error
}

SubscriptionListenEmitter is returned to user to be called each time new subscription should be triggered.

type SubscriptionListenHandler

type SubscriptionListenHandler interface {
	Handle(driver.SubscriptionListenInput, SubscriptionListenEmitter) error
}

SubscriptionListenHandler interface that must be implemented by user for handling subscription listen handler.

type UnionResolveTypeHandler

type UnionResolveTypeHandler interface {
	// Handle takes UnionResolveTypeInput as a type resolution input and returns
	// type name.
	Handle(driver.UnionResolveTypeInput) (string, error)
}

UnionResolveTypeHandler union implemented by user to handle union type resolution

type UnionResolveTypeHandlerFunc

type UnionResolveTypeHandlerFunc func(driver.UnionResolveTypeInput) (string, error)

UnionResolveTypeHandlerFunc is a convienience function wrapper implementing UnionResolveTypeHandler

func (UnionResolveTypeHandlerFunc) Handle

Handle takes UnionResolveTypeInput as a type resolution input and returns type name.

Jump to

Keyboard shortcuts

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