file

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

README

Conduit Connector File

General

The File plugin is one of Conduit builtin plugins. It provides both source and destination File connectors, allowing for a file to be either a source, or a destination in a Conduit pipeline.

How to build it

Run make.

Testing

Run make test to run all the tests.

How it works

The Source connector listens for changes appended to the source file and sends records with the changes. The Destination connector receives records and writes them to a file.

Source

The Source connector only cares to have a valid path, even if the file doesn't exist, it will still run and wait until a file with the configured name is there, then it will start listening to changes and sending records.

Destination

The Destination connector will create the file if it doesn't exist, and records with changes will be appended to the destination file when received.

Configuration
name part of description required default value
path destination, source The path to the file true
Limitations
  • The Source connector only detects appended changes to the file, so it doesn't detect deletes or edits.
  • The connectors can only access local files on the machine where Conduit is running. So, running Conduit on a server means it can't access a file on your local machine.
  • Currently, only works reliably with text files (may work with non-text files, but not guaranteed)

Documentation

Index

Constants

View Source
const (
	// ConfigPath is the config name for the path to the file.
	ConfigPath = "path"
)
View Source
const MetadataFilePath = "file.path"

Variables

View Source
var Connector = sdk.Connector{
	NewSpecification: Specification,
	NewSource:        NewSource,
	NewDestination:   NewDestination,
}

Functions

func NewDestination

func NewDestination() sdk.Destination

func NewSource

func NewSource() sdk.Source

func Specification

func Specification() sdk.Specification

Specification returns the connector's specification.

Types

type Destination

type Destination struct {
	sdk.UnimplementedDestination
	// contains filtered or unexported fields
}

Destination connector

func (*Destination) Configure

func (d *Destination) Configure(ctx context.Context, m map[string]string) error

func (*Destination) Open

func (d *Destination) Open(ctx context.Context) error

func (*Destination) Parameters added in v0.3.0

func (d *Destination) Parameters() map[string]sdk.Parameter

func (*Destination) Teardown

func (d *Destination) Teardown(ctx context.Context) error

func (*Destination) Write

func (d *Destination) Write(ctx context.Context, recs []sdk.Record) (int, error)

type Source

type Source struct {
	sdk.UnimplementedSource
	// contains filtered or unexported fields
}

Source connector

func (*Source) Ack

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

func (*Source) Configure

func (s *Source) Configure(ctx context.Context, m map[string]string) error

func (*Source) Open

func (s *Source) Open(ctx context.Context, position sdk.Position) error

func (*Source) Parameters added in v0.3.0

func (s *Source) Parameters() map[string]sdk.Parameter

func (*Source) Read

func (s *Source) Read(ctx context.Context) (sdk.Record, error)

func (*Source) Teardown

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

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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