file

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2017 License: BSD-3-Clause Imports: 13 Imported by: 0

README

file adaptor

The file adaptor reads/writes data to the defined locations.

NOTE

This adaptor is primarily used for testing purposes.

Configuration:
- stdout:
    type: file
    uri: stdout://

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultURI = "stdout://"
)

DefaultURI is the default file, outputs to stdout

Functions

This section is empty.

Types

type Client

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

Client represents a client to the underlying File source.

func NewClient

func NewClient(options ...ClientOptionFunc) (*Client, error)

NewClient creates a default file client

func (*Client) Close

func (c *Client) Close()

Close closes the underlying file

func (*Client) Connect

func (c *Client) Connect() (client.Session, error)

Connect initializes the file for IO

type ClientOptionFunc

type ClientOptionFunc func(*Client) error

ClientOptionFunc is a function that configures a Client. It is used in NewClient.

func WithURI

func WithURI(uri string) ClientOptionFunc

WithURI defines the full path to the file, prefixed with file://, or stdout://

type Config

type Config struct {
	URI string `json:"uri" doc:"the uri to connect to, ie stdout://, file:///tmp/output"`
}

Config is used to configure the File Adaptor

type File

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

File is an adaptor that can be used as a source / sink for file's on disk, as well as a sink to stdout.

func (*File) Description

func (f *File) Description() string

Description for file adaptor

func (*File) Listen

func (f *File) Listen() error

Listen starts the listener

func (*File) SampleConfig

func (f *File) SampleConfig() string

SampleConfig for file adaptor

func (*File) Start

func (f *File) Start() (err error)

Start the file adaptor

func (*File) Stop

func (f *File) Stop() error

Stop the adaptor

type Reader

type Reader struct{}

Reader implements the behavior defined by client.Reader for interfacing with the file.

func (*Reader) Read

func (r *Reader) Read(filterFn client.NsFilterFunc) client.MessageChanFunc

type Session

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

Session serves as a wrapper for the underlying file

type Writer

type Writer struct{}

Writer implements client.Writer for use with Files

func (*Writer) Write

func (w *Writer) Write(msg message.Msg) func(client.Session) error

Jump to

Keyboard shortcuts

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