Documentation
¶
Index ¶
- type Batch
- type Buffer
- type Clickhouse
- 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 RetryPacket
- type Retryable
- type Vector
- type VectorDecoded
- type Vectorable
- type View
- type Writeable
- type Writer
- type WriterBlocking
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
Batch holds information for sending rows batch
type Buffer ¶
Buffer it is the interface for creating a data buffer (temporary storage). It is enough to implement this interface so that you can use your own temporary storage
type Clickhouse ¶
type Client ¶
type Client interface {
// Options returns the options associated with client
Options() *Options
// WriteBatch method of sending data to Clickhouse is used implicitly in a non - blocking record,
// and explicitly in a blocking record
WriteBatch(context.Context, View, *Batch) error
// Writer returns the asynchronous, non-blocking, Writer client.
// Ensures using a single Writer instance for each table pair.
Writer(View, Buffer) Writer
// WriterBlocking returns the synchronous, blocking, WriterBlocking client.
// Ensures using a single WriterBlocking instance for each table pair.
WriterBlocking(View) WriterBlocking
// RetryClient Get retry client
RetryClient() Retryable
// Close ensures all ongoing asynchronous write clients finish.
Close()
}
func NewClientWithOptions ¶
func NewClientWithOptions(ctx context.Context, clickhouse Clickhouse, options *Options) Client
type Logger ¶
type Logger interface {
Log(message interface{})
Logf(format string, v ...interface{})
}
func NewDefaultLogger ¶
func NewDefaultLogger() Logger
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
}
func NewImMemoryQueueEngine ¶
func NewImMemoryQueueEngine() Queueable
type RetryPacket ¶
type RetryPacket struct {
// contains filtered or unexported fields
}
func NewRetryPacket ¶
func NewRetryPacket(view View, batch *Batch) *RetryPacket
type Retryable ¶
type Retryable interface {
Retry(packet *RetryPacket)
Metrics() (uint64, uint64, uint64)
}
type VectorDecoded ¶
type VectorDecoded string
func (VectorDecoded) Decode ¶
func (rd VectorDecoded) Decode() (Vector, error)
Decode This method is required to reverse deserialize an array of bytes in a Vector type
type Vectorable ¶
type Vectorable interface {
Row() Vector
}
Vectorable interface is an assistant in the correct formation of the order of fields in the data before sending it to Clickhouse
type Writeable ¶
func NewDefaultWriter ¶
func NewDefaultWriter(conn Clickhouse) Writeable
type Writer ¶
type Writer interface {
// WriteRow writes asynchronously line protocol record into bucket.
WriteRow(vector Vectorable)
// 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 ...Vectorable) error
}
func NewWriterBlocking ¶
func NewWriterBlocking(client Client, view View) WriterBlocking
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
cmd/redis
command
|
|
|
cmd/redis_sql
command
|
|
|
cmd/simple
command
|
|
|
cmd/simple_2
command
|
|
|
cmd/simple_sql
command
|
|
|
src
|
|