file

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2017 License: BSD-3-Clause Imports: 11 Imported by: 3

README

file adaptor

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

NOTE

This adaptor is primarily used for testing purposes.

Configuration:
f = 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 File

type File struct {
	adaptor.BaseConfig
}

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) Client added in v0.3.0

func (f *File) Client() (client.Client, error)

Client creates an instance of Client to be used for reading/writing to a file.

func (*File) Description

func (f *File) Description() string

Description for file adaptor

func (*File) Reader added in v0.3.0

func (f *File) Reader() (client.Reader, error)

Reader instantiates a Reader for use with working with the file.

func (*File) SampleConfig

func (f *File) SampleConfig() string

SampleConfig for file adaptor

func (*File) Writer added in v0.3.0

func (f *File) Writer(done chan struct{}, wg *sync.WaitGroup) (client.Writer, error)

Writer instantiates a Writer for use with working with the file.

type Reader

type Reader struct{}

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

func (*Reader) Read

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) (message.Msg, error)

Jump to

Keyboard shortcuts

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