evexi

package module
v0.0.0-...-cc633bb Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: MIT Imports: 13 Imported by: 0

README

evexi

Simple, synchronous, writable byte buffer meant for exporting

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExportFuncNotSet       = errors.New("export function was not set")
	ErrNegativeOrZeroInterval = errors.New("the export interval was negative or zero")
)

Errors

Functions

func ExportToDisk

func ExportToDisk(path string, fileNamePrefix string) (func([]byte), error)

ExportToDisk exports to the specified path, else the current directory

func ExportToS3

func ExportToS3(sess *session.Session, bucket string, folders []string, fileNamePrefix string) func([]byte)

ExportToS3 exports to the specified bucket, folders and fileNamePrefix are joined

func MustExportToDisk

func MustExportToDisk(path string, fileNamePrefix string) func([]byte)

MustExportToDisk panics if os.Getwd() fails

Types

type Evexi

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

Evexi should be initialized by the New func

func New

func New(export func([]byte), bufferMaxSize int) (*Evexi, error)

New exports function must not be nil

func (*Evexi) Bytes

func (e *Evexi) Bytes() []byte

Bytes makes a copy of the data

func (*Evexi) Export

func (e *Evexi) Export(reset bool)

Export calls the underlying export func with mux locking and the option to reset the buffer

func (*Evexi) IntervalExport

func (e *Evexi) IntervalExport(exportInterval time.Duration) (func(), error)

IntervalExport must recieve a positive interval Returns a cancellable goroutine that exports the buffer at the provided interval

func (*Evexi) Reset

func (e *Evexi) Reset()

Reset resets the buffer

func (*Evexi) Write

func (e *Evexi) Write(data []byte) (n int, err error)

Jump to

Keyboard shortcuts

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