file

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

README

Overview

The Conduit File plugin provides both source and destination connectors, allowing for a file to be either a source or a destination in a Conduit pipeline.

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.

How to build it

Run make build-file-plugin.

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"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Destination

type Destination struct {
	Scanner *bufio.Scanner
	File    *os.File
	Config  map[string]string
}

Destination connector

func (*Destination) Open

func (c *Destination) Open(ctx context.Context, config plugins.Config) error

func (*Destination) Teardown

func (c *Destination) Teardown() error

func (*Destination) Validate

func (c *Destination) Validate(cfg plugins.Config) error

func (*Destination) Write

type Source

type Source struct {
	Tail   *tail.Tail
	Config map[string]string
	// contains filtered or unexported fields
}

Source connector

func (*Source) Ack

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

func (*Source) Open

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

func (*Source) Read

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

func (*Source) Teardown

func (c *Source) Teardown() error

func (*Source) Validate

func (c *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