Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var NoErrorHandler = func(data []byte, err error) {}
NoErrorHandler is an empty function that is used when no ErrorHandler is required One may always process all their errors directly in the FlushFunc.
Functions ¶
This section is empty.
Types ¶
type ErrorHandlerFunc ¶
ErrorHandlerFunc is a function that gets errors occured in FlushFunc It will also get a buffer copy so that you could somehow analyze it. After this function is called, the buffer is destroyed automatically by the calling code (i.e. you do not need to clean it up yourself).
type FlushFunc ¶
A function of a FlushFunc type once called will receive a buffer containing all the data from writes made after the previous FlushFunc call. The data buffer will be cleaned up automatically after this function is executed (i.e. you do not need to clean it up yourself). Any error returned from this function will be passed to a ErrorHandlerFunc function
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer is an implenetation of an io.WriteCloser interface. It lets creating a buffered writer that can flush (and thus physically write) the buffer by a time ticker or by manual calls of Writer.Flush().
func NewBulkWriter ¶
NewBulkWriter creates a new bulk.Writer instance flushInterval - how often to call the flushFunc, if set to a nonpositive value will effectively turn
off automatic flushing
flushFunc - defines what to do on flush
func NewBulkWriterWithErrorHandler ¶
func NewBulkWriterWithErrorHandler(flushInterval time.Duration, flushFunc FlushFunc, errorHandler ErrorHandlerFunc) *Writer
NewBulkWriterWithErrorHandler creates a new bulk.Writer instance flushInterval - how often to call the flushFunc, if set to a nonpositive value will effectively turn
off automatic flushing
flushFunc - defines what to do on flush errorHandler - whenever your flushFunc returns an error, it can be processed in this function
func (*Writer) Close ¶
Close is an implementation of an io.Closer interface. It closes the writer, stops any activity and any subsiquent operations will result in a error. It will return an error if called after Close() was called.