Documentation ¶
Index ¶
- type Client
- type Closable
- type Countable
- type Logger
- type Options
- func (o *Options) BatchSize() uint
- func (o *Options) FlushInterval() uint
- func (o *Options) SetBatchSize(batchSize uint) *Options
- func (o *Options) SetDebugMode(isDebug bool) *Options
- func (o *Options) SetFlushInterval(flushIntervalMs uint) *Options
- func (o *Options) SetLogger(logger Logger) *Options
- func (o *Options) SetQueueEngine(queue Queueable) *Options
- func (o *Options) SetRetryIsEnabled(enabled bool) *Options
- type Queueable
- type Retryable
- type Writeable
- type Writer
- type WriterBlocking
- type WriterBlockingImpl
- type WriterImpl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Options returns the options associated with client Options() *Options // HandleStream method for processing data x and sending it to Clickhouse HandleStream(database.View, *buffer.Batch) error // WriteBatch method of sending data to Clickhouse is used implicitly in a non - blocking record, // and explicitly in a blocking record WriteBatch(context.Context, database.View, *buffer.Batch) error // Writer returns the asynchronous, non-blocking, Writer client. // Ensures using a single Writer instance for each table pair. Writer(database.View, buffer.Buffer) Writer // WriterBlocking returns the synchronous, blocking, WriterBlocking client. // Ensures using a single WriterBlocking instance for each table pair. WriterBlocking(database.View) WriterBlocking // RetryClient Get retry client RetryClient() Retryable // Close ensures all ongoing asynchronous write clients finish. Close() }
func NewClientWithOptions ¶
type Logger ¶
type Logger interface { Log(message interface{}) Logf(format string, v ...interface{}) }
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options holds write configuration properties
func DefaultOptions ¶
func DefaultOptions() *Options
DefaultOptions returns Options object with default values
func (*Options) FlushInterval ¶
FlushInterval returns flush interval in ms
func (*Options) SetBatchSize ¶
SetBatchSize sets number of rows sent in single request
func (*Options) SetDebugMode ¶
func (*Options) SetFlushInterval ¶
SetFlushInterval sets flush interval in ms in which is buffer flushed if it has not been already written
func (*Options) SetQueueEngine ¶
func (*Options) SetRetryIsEnabled ¶
type Queueable ¶
type Queueable interface { Queue(packet *retryPacket) Retries() <-chan *retryPacket }
type Writeable ¶
type Writeable interface {
Write(ctx context.Context, view database.View, batch *buffer.Batch) (uint64, error)
}
func NewDefaultWriter ¶
func NewDefaultWriter(conn database.Clickhouse) Writeable
type Writer ¶
type Writer interface { // WriteRow writes asynchronously line protocol record into bucket. WriteRow(vector buffer.Inline) // Flush forces all pending writes from the buffer to be sent Flush() // Errors returns a channel for reading errors which occurs during async writes. Errors() <-chan error // Close writer Close() }
Writer is client interface with non-blocking methods for writing rows asynchronously in batches into an Clickhouse server. Writer can be used concurrently. When using multiple goroutines for writing, use a single WriteAPI instance in all goroutines.
type WriterBlocking ¶
type WriterBlocking interface { // WriteRow writes row(s) into bucket. // WriteRow writes without implicit batching. Batch is created from given number of records // Non-blocking alternative is available in the Writer interface WriteRow(ctx context.Context, row ...buffer.Inline) error }
func NewWriterBlocking ¶
func NewWriterBlocking(streamer Client, view database.View) WriterBlocking
type WriterBlockingImpl ¶
type WriterBlockingImpl struct {
// contains filtered or unexported fields
}
type WriterImpl ¶
type WriterImpl struct {
// contains filtered or unexported fields
}
func (*WriterImpl) Close ¶
func (w *WriterImpl) Close()
Close finishes outstanding write operations, stop background routines and closes all channels
func (*WriterImpl) Errors ¶
func (w *WriterImpl) Errors() <-chan error
Errors returns a channel for reading errors which occurs during async writes. Must be called before performing any writes for errors to be collected. The chan is unbuffered and must be drained or the writer will block.
func (*WriterImpl) Flush ¶
func (w *WriterImpl) Flush()
Flush forces all pending writes from the buffer to be sent
func (*WriterImpl) WriteRow ¶
func (w *WriterImpl) WriteRow(rower buffer.Inline)
WriteRow writes asynchronously line protocol record into bucket. WriteRow adds record into the buffer which is sent on the background when it reaches the batch size.