generator

package
v0.2.0-nightly.20220209 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

README

General

The generator plugin is able to generate sample records with its source. It has no destination and trying to use it will result in an error.

The data is generated in JSON format. The JSON objects themselves are generated using a field specification, which is explained in more details in the Configuration section below.

The plugin is great for getting started with Conduit but also for certain types of performance tests.

How to build?

Run make build-generator-plugin.

Testing

Run make test to run all the unit tests.

Configuration

recordCount The number of records to be generated. If a negative value is used, the source will generate records until stopped.

readTime The time it takes to 'read' a record. It can be used to simulate latency and, for example, simulate slow or fast sources.

fields A comma-separated list of name:type tokens, where type can be: int, string, time, bool. An example is: id:int,name:string,joined:time,admin:bool.

Documentation

Index

Constants

View Source
const (
	RecordCount = "recordCount"
	ReadTime    = "readTime"
	Fields      = "fields"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	RecordCount int64
	ReadTime    time.Duration
	Fields      map[string]string
}

func Parse

func Parse(config plugins.Config) (Config, error)

type Source

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

Source connector

func (*Source) Ack

func (s *Source) Ack(ctx context.Context, position record.Position) error

func (*Source) Open

func (s *Source) Open(ctx context.Context, config plugins.Config) error

func (*Source) Read

func (s *Source) Read(ctx context.Context, p record.Position) (record.Record, error)

func (*Source) Teardown

func (s *Source) Teardown() error

func (*Source) Validate

func (s *Source) Validate(cfg plugins.Config) error

type Spec

type Spec struct{}

func (Spec) Specify

func (s Spec) Specify() (plugins.Specification, error)

Specify returns the Plugin's Specification

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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