grpc

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SourceID      string                 `json:"source_id" yaml:"source_id"`
	Address       string                 `json:"address" yaml:"address"`
	Method        string                 `json:"method" yaml:"method"` // full method: /package.Service/Method
	TLS           bool                   `json:"tls" yaml:"tls"`
	ServerName    string                 `json:"server_name" yaml:"server_name"`
	Headers       map[string]string      `json:"headers" yaml:"headers"`
	Request       map[string]interface{} `json:"request" yaml:"request"`
	SchemaName    string                 `json:"schema_name" yaml:"schema_name"`
	SchemaVersion string                 `json:"schema_version" yaml:"schema_version"`
	FactTypeField string                 `json:"fact_type_field" yaml:"fact_type_field"`
	Timeout       time.Duration          `json:"timeout" yaml:"timeout"`
	BufferSize    int                    `json:"buffer_size" yaml:"buffer_size"`
}

Config holds gRPC adapter configuration.

type Factory

type Factory struct{}

Factory creates gRPC sources from generic config.

func (*Factory) Create

func (f *Factory) Create(config adapters.SourceConfig) (adapters.FactSource, error)

func (*Factory) GetConfigSchema

func (f *Factory) GetConfigSchema() adapters.ConfigSchema

func (*Factory) ValidateConfig

func (f *Factory) ValidateConfig(config adapters.SourceConfig) error

type Source

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

Source implements gRPC streaming as a fact source.

func NewSource

func NewSource(config *Config, mappings []adapters.FactMapping) (*Source, error)

NewSource creates a new gRPC source.

func (*Source) GetMetadata

func (s *Source) GetMetadata() adapters.SourceMetadata

GetMetadata returns source metadata.

func (*Source) GetSourceSchema

func (s *Source) GetSourceSchema() *adapters.Schema

GetSourceSchema returns schema metadata.

func (*Source) HealthCheck

func (s *Source) HealthCheck() error

HealthCheck checks connection status.

func (*Source) Start

func (s *Source) Start(ctx context.Context) error

Start connects to the gRPC server.

func (*Source) Stop

func (s *Source) Stop(ctx context.Context) error

Stop stops the stream and closes the connection.

func (*Source) Subscribe

func (s *Source) Subscribe(ctx context.Context, factTypes []string) (<-chan *adapters.TypedFact, error)

Subscribe starts the gRPC stream.

Jump to

Keyboard shortcuts

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