coordinator

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MIT Imports: 36 Imported by: 0

Documentation

Overview

Package coordinator contains abstractions for writing points, executing statements, and accessing meta data.

Index

Constants

View Source
const (
	// DefaultWriteTimeout is the default timeout for a complete write to succeed.
	DefaultWriteTimeout = 10 * time.Second

	// DefaultShardWriterTimeout is the default timeout set on shard writers.
	DefaultShardWriterTimeout = 5 * time.Second

	// DefaultShardMapperTimeout is the default timeout set on shard mappers.
	DefaultShardMapperTimeout = 5 * time.Second

	// DefaultMaxRemoteWriteConnections is the maximum number of open connections
	// that will be available for remote writes to another host.
	DefaultMaxRemoteWriteConnections = 3

	// DefaultMaxConcurrentQueries is the maximum number of running queries.
	// A value of zero will make the maximum query limit unlimited.
	DefaultMaxConcurrentQueries = 0

	// DefaultMaxSelectPointN is the maximum number of points a SELECT can process.
	// A value of zero will make the maximum point count unlimited.
	DefaultMaxSelectPointN = 0

	// DefaultMaxSelectSeriesN is the maximum number of series a SELECT can run.
	// A value of zero will make the maximum series count unlimited.
	DefaultMaxSelectSeriesN = 0
)
View Source
const MaxMessageSize = 1024 * 1024 * 1024 // 1GB

MaxMessageSize defines how large a message can be before we reject it

View Source
const MuxHeader = "coordinator"

MuxHeader is the header byte used in the TCP mux.

Variables

View Source
var (
	// ErrTimeout is returned when a write times out.
	ErrTimeout = errors.New("timeout")

	// ErrPartialWrite is returned when a write partially succeeds but does
	// not meet the requested consistency level.
	ErrPartialWrite = errors.New("partial write")

	// ErrWriteFailed is returned when no writes succeeded.
	ErrWriteFailed = errors.New("write failed")

	// ErrInvalidConsistencyLevel is returned when parsing the string version
	// of a consistency level.
	ErrInvalidConsistencyLevel = errors.New("invalid consistency level")
)
View Source
var ErrDatabaseNameRequired = errors.New("database name required")

ErrDatabaseNameRequired is returned when executing statements that require a database, when a database has not been provided.

Functions

func DecodeLV

func DecodeLV(r io.Reader, v encoding.BinaryUnmarshaler) error

DecodeLV reads the length-value record from r and unmarshals it into v.

func DecodeTLV

func DecodeTLV(r io.Reader, v encoding.BinaryUnmarshaler) (typ byte, err error)

DecodeTLV reads the type-length-value record from r and unmarshals it into v.

func EncodeLV

func EncodeLV(w io.Writer, v encoding.BinaryMarshaler) error

EncodeLV encodes v to a binary format and writes the length-value record to w.

func EncodeTLV

func EncodeTLV(w io.Writer, typ byte, v encoding.BinaryMarshaler) error

EncodeTLV encodes v to a binary format and writes the record-length-value record to w.

func NewBoundedPool

func NewBoundedPool(initialCap, maxCap int, timeout time.Duration, factory Factory) (pool.Pool, error)

NewBoundedPool returns a new pool based on buffered channels with an initial capacity, maximum capacity and timeout to wait for a connection from the pool. Factory is used when initial capacity is greater than zero to fill the pool. A zero initialCap doesn't fill the Pool until a new Get() is called. During a Get(), If there is no new connection available in the pool and total connections is less than the max, a new connection will be created via the Factory() method. Othewise, the call will block until a connection is available or the timeout is reached.

func ReadLV

func ReadLV(r io.Reader) ([]byte, error)

ReadLV reads the length-value from a TLV record.

func ReadTLV

func ReadTLV(r io.Reader) (byte, []byte, error)

ReadTLV reads a type-length-value record from r.

func ReadType

func ReadType(r io.Reader) (byte, error)

ReadType reads the type from a TLV record.

func WriteLV

func WriteLV(w io.Writer, buf []byte) error

WriteLV writes the length-value in a TLV record to w.

func WriteTLV

func WriteTLV(w io.Writer, typ byte, buf []byte) error

WriteTLV writes a type-length-value record to w.

func WriteType

func WriteType(w io.Writer, typ byte) error

WriteType writes the type in a TLV record to w.

Types

type BufferedPointsWriter

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

BufferedPointsWriter adds buffering to a pointsWriter so that SELECT INTO queries write their points to the destination in batches.

func NewBufferedPointsWriter

func NewBufferedPointsWriter(w pointsWriter, database, retentionPolicy string, capacity int) *BufferedPointsWriter

NewBufferedPointsWriter returns a new BufferedPointsWriter.

func (*BufferedPointsWriter) Cap

func (w *BufferedPointsWriter) Cap() int

Cap returns the capacity (in points) of the buffer.

func (*BufferedPointsWriter) Flush

func (w *BufferedPointsWriter) Flush() error

Flush writes all buffered points to the underlying writer.

func (*BufferedPointsWriter) Len

func (w *BufferedPointsWriter) Len() int

Len returns the number of points buffered.

func (*BufferedPointsWriter) WritePointsInto

func (w *BufferedPointsWriter) WritePointsInto(req *IntoWriteRequest) error

WritePointsInto implements pointsWriter for BufferedPointsWriter.

type Config

type Config struct {
	ForceRemoteShardMapping   bool          `toml:"force-remote-mapping"`
	WriteTimeout              toml.Duration `toml:"write-timeout"`
	ShardWriterTimeout        toml.Duration `toml:"shard-writer-timeout"`
	MaxRemoteWriteConnections int           `toml:"max-remote-write-connections"`
	ShardMapperTimeout        toml.Duration `toml:"shard-mapper-timeout"`

	MaxConcurrentQueries int           `toml:"max-concurrent-queries"`
	QueryTimeout         toml.Duration `toml:"query-timeout"`
	LogQueriesAfter      toml.Duration `toml:"log-queries-after"`
	MaxSelectPointN      int           `toml:"max-select-point"`
	MaxSelectSeriesN     int           `toml:"max-select-series"`
	MaxSelectBucketsN    int           `toml:"max-select-buckets"`
}

Config represents the configuration for the coordinator service.

func NewConfig

func NewConfig() Config

NewConfig returns an instance of Config with defaults.

func (Config) Diagnostics

func (c Config) Diagnostics() (*diagnostics.Diagnostics, error)

Diagnostics returns a diagnostics representation of a subset of the Config.

type CreateIteratorRequest

type CreateIteratorRequest struct {
	ShardIDs    []uint64
	Measurement cnosql.Measurement
	Opt         query.IteratorOptions
}

CreateIteratorRequest represents a request to create a remote iterator.

func (*CreateIteratorRequest) MarshalBinary

func (r *CreateIteratorRequest) MarshalBinary() ([]byte, error)

MarshalBinary encodes r to a binary format.

func (*CreateIteratorRequest) UnmarshalBinary

func (r *CreateIteratorRequest) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes data into r.

type CreateIteratorResponse

type CreateIteratorResponse struct {
	Err error
	// contains filtered or unexported fields
}

CreateIteratorResponse represents a response from remote iterator creation.

func (*CreateIteratorResponse) MarshalBinary

func (r *CreateIteratorResponse) MarshalBinary() ([]byte, error)

MarshalBinary encodes r to a binary format.

func (*CreateIteratorResponse) UnmarshalBinary

func (r *CreateIteratorResponse) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes data into r.

type ExecuteStatementRequest

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

ExecuteStatementRequest represents the a request to execute a statement on a node.

func (*ExecuteStatementRequest) Database

func (r *ExecuteStatementRequest) Database() string

Database returns the database name.

func (*ExecuteStatementRequest) MarshalBinary

func (r *ExecuteStatementRequest) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object to a binary format.

func (*ExecuteStatementRequest) SetDatabase

func (r *ExecuteStatementRequest) SetDatabase(database string)

SetDatabase sets the database name.

func (*ExecuteStatementRequest) SetStatement

func (r *ExecuteStatementRequest) SetStatement(statement string)

SetStatement sets the CnosQL statement.

func (*ExecuteStatementRequest) Statement

func (r *ExecuteStatementRequest) Statement() string

Statement returns the CnosQL statement.

func (*ExecuteStatementRequest) UnmarshalBinary

func (r *ExecuteStatementRequest) UnmarshalBinary(buf []byte) error

UnmarshalBinary populates ExecuteStatementRequest from a binary format.

type ExecuteStatementResponse

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

ExecuteStatementResponse represents the response returned from a remote ExecuteStatementRequest call.

func (*ExecuteStatementResponse) Code

func (w *ExecuteStatementResponse) Code() int

Code returns the response code.

func (*ExecuteStatementResponse) MarshalBinary

func (w *ExecuteStatementResponse) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object to a binary format.

func (*ExecuteStatementResponse) Message

func (w *ExecuteStatementResponse) Message() string

Message returns the repsonse message.

func (*ExecuteStatementResponse) SetCode

func (w *ExecuteStatementResponse) SetCode(code int)

SetCode sets the Code

func (*ExecuteStatementResponse) SetMessage

func (w *ExecuteStatementResponse) SetMessage(message string)

SetMessage sets the Message

func (*ExecuteStatementResponse) UnmarshalBinary

func (w *ExecuteStatementResponse) UnmarshalBinary(buf []byte) error

UnmarshalBinary populates ExecuteStatementResponse from a binary format.

type Factory

type Factory func() (net.Conn, error)

Factory is a function to create new connections.

type FieldDimensionsRequest

type FieldDimensionsRequest struct {
	ShardIDs    []uint64
	Measurement cnosql.Measurement
}

FieldDimensionsRequest represents a request to retrieve unique fields & dimensions.

func (*FieldDimensionsRequest) MarshalBinary

func (r *FieldDimensionsRequest) MarshalBinary() ([]byte, error)

MarshalBinary encodes r to a binary format.

func (*FieldDimensionsRequest) UnmarshalBinary

func (r *FieldDimensionsRequest) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes data into r.

type FieldDimensionsResponse

type FieldDimensionsResponse struct {
	Fields     map[string]cnosql.DataType
	Dimensions map[string]struct{}
	Err        error
}

FieldDimensionsResponse represents a response from remote iterator creation.

func (*FieldDimensionsResponse) MarshalBinary

func (r *FieldDimensionsResponse) MarshalBinary() ([]byte, error)

MarshalBinary encodes r to a binary format.

func (*FieldDimensionsResponse) UnmarshalBinary

func (r *FieldDimensionsResponse) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes data into r.

type IntoWriteRequest

type IntoWriteRequest struct {
	Database        string
	RetentionPolicy string
	Points          []models.Point
}

IntoWriteRequest is a partial copy of cluster.WriteRequest

type IteratorCreator

type IteratorCreator interface {
	query.IteratorCreator
	cnosql.FieldMapper
	io.Closer
}

IteratorCreator is an interface that combines mapping fields and creating iterators.

type LocalShardMapper

type LocalShardMapper struct {
	//MetaClient interface {
	//	ShardGroupsByTimeRange(database, policy string, min, max time.Time) (a []meta.ShardGroupInfo, err error)
	//}
	MetaClient MetaClient

	TSDBStore interface {
		ShardGroup(ids []uint64) tsdb.ShardGroup
		Shards(ids []uint64) []*tsdb.Shard
		CreateShard(database, retentionPolicy string, shardID uint64, enabled bool) error
	}
}

LocalShardMapper implements a ShardMapper for local shards.

func (*LocalShardMapper) MapShards

MapShards maps the sources to the appropriate shards into an IteratorCreator.

type LocalShardMapping

type LocalShardMapping struct {
	ShardMap map[Source]tsdb.ShardGroup

	RemoteICs map[Source][]remoteIteratorCreator

	// MinTime is the minimum time that this shard mapper will allow.
	// Any attempt to use a time before this one will automatically result in using
	// this time instead.
	MinTime time.Time

	// MaxTime is the maximum time that this shard mapper will allow.
	// Any attempt to use a time after this one will automatically result in using
	// this time instead.
	MaxTime time.Time

	LocalNodeID uint64
}

ShardMapper maps data sources to a list of shard information.

func (*LocalShardMapping) Close

func (a *LocalShardMapping) Close() error

Close clears out the list of mapped shards.

func (*LocalShardMapping) CreateIterator

func (*LocalShardMapping) FieldDimensions

func (a *LocalShardMapping) FieldDimensions(m *cnosql.Measurement) (fields map[string]cnosql.DataType, dimensions map[string]struct{}, err error)

func (*LocalShardMapping) IteratorCost

func (*LocalShardMapping) MapType

func (a *LocalShardMapping) MapType(m *cnosql.Measurement, field string) cnosql.DataType

type LocalTSDBStore

type LocalTSDBStore struct {
	*tsdb.Store
}

LocalTSDBStore embeds a tsdb.Store and implements IteratorCreator to satisfy the TSDBStore interface.

type MetaClient

type MetaClient interface {
	CreateContinuousQuery(database, name, query string) error
	CreateDatabase(name string) (*meta.DatabaseInfo, error)
	CreateDatabaseWithRetentionPolicy(name string, spec *meta.RetentionPolicySpec) (*meta.DatabaseInfo, error)
	CreateRetentionPolicy(database string, spec *meta.RetentionPolicySpec, makeDefault bool) (*meta.RetentionPolicyInfo, error)
	CreateSubscription(database, rp, name, mode string, destinations []string) error
	CreateUser(name, password string, admin bool) (meta.User, error)
	Database(name string) *meta.DatabaseInfo
	Databases() []meta.DatabaseInfo
	DataNode(id uint64) (*meta.NodeInfo, error)
	DataNodes() ([]meta.NodeInfo, error)
	DeleteDataNode(id uint64) error
	MetaNodes() ([]meta.NodeInfo, error)
	DeleteMetaNode(id uint64) error
	DropShard(id uint64) error
	DropContinuousQuery(database, name string) error
	DropDatabase(name string) error
	DropRetentionPolicy(database, name string) error
	DropSubscription(database, rp, name string) error
	DropUser(name string) error
	ShardGroupsByTimeRange(database, rp string, min, max time.Time) (a []meta.ShardGroupInfo, err error)
	SetAdminPrivilege(username string, admin bool) error
	SetDefaultRetentionPolicy(database, name string) error
	SetPrivilege(username, database string, p cnosql.Privilege) error
	ShardsByTimeRange(sources cnosql.Sources, tmin, tmax time.Time) (a []meta.ShardInfo, err error)
	RetentionPolicy(database, name string) (rp *meta.RetentionPolicyInfo, err error)
	TruncateShardGroups(t time.Time) error
	UpdateRetentionPolicy(database, name string, rpu *meta.RetentionPolicyUpdate, makeDefault bool) error
	UpdateUser(name, password string) error
	UserPrivilege(username, database string) (*cnosql.Privilege, error)
	UserPrivileges(username string) (map[string]cnosql.Privilege, error)
	Users() []meta.UserInfo
}

MetaClient is an interface for accessing meta data.

type MetaExecutor

type MetaExecutor struct {
	Logger *log.Logger
	Node   *cnosdb.Node

	MetaClient interface {
		DataNode(id uint64) (ni *meta.NodeInfo, err error)
		DataNodes() ([]meta.NodeInfo, error)
	}
	// contains filtered or unexported fields
}

MetaExecutor executes meta queries on all data nodes.

func NewMetaExecutor

func NewMetaExecutor() *MetaExecutor

NewMetaExecutor returns a new initialized *MetaExecutor.

func (*MetaExecutor) ExecuteStatement

func (m *MetaExecutor) ExecuteStatement(stmt cnosql.Statement, database string) error

ExecuteStatement executes a single CnosQL statement on all nodes in the cluster concurrently.

type NodeDialer

type NodeDialer struct {
	MetaClient MetaClient
	Timeout    time.Duration
}

NodeDialer dials connections to a given node.

func (*NodeDialer) DialNode

func (d *NodeDialer) DialNode(nodeID uint64) (net.Conn, error)

DialNode returns a connection to a node.

type PointsWriter

type PointsWriter struct {
	WriteTimeout time.Duration
	Logger       *zap.Logger

	Node *cnosdb.Node

	MetaClient interface {
		Database(name string) (di *meta.DatabaseInfo)
		RetentionPolicy(database, rp string) (*meta.RetentionPolicyInfo, error)
		CreateShardGroup(database, rp string, timestamp time.Time) (*meta.ShardGroupInfo, error)
	}

	TSDBStore interface {
		CreateShard(database, retentionPolicy string, shardID uint64, enabled bool) error
		WriteToShard(shardID uint64, points []models.Point) error
	}

	ShardWriter interface {
		WriteShard(shardID, ownerID uint64, points []models.Point) error
	}

	HintedHandoff interface {
		WriteShard(shardID, ownerID uint64, points []models.Point) error
	}

	Subscriber interface {
		Points() chan<- *WritePointsRequest
	}
	// contains filtered or unexported fields
}

PointsWriter handles writes across multiple local and remote data nodes.

func NewPointsWriter

func NewPointsWriter() *PointsWriter

NewPointsWriter returns a new instance of PointsWriter for a node.

func (*PointsWriter) AddWriteSubscriber

func (w *PointsWriter) AddWriteSubscriber(c chan<- *WritePointsRequest)

func (*PointsWriter) Close

func (w *PointsWriter) Close() error

Close closes the communication channel with the point writer.

func (*PointsWriter) MapShards

func (w *PointsWriter) MapShards(wp *WritePointsRequest) (*ShardMapping, error)

MapShards maps the points contained in wp to a ShardMapping. If a point maps to a shard group or shard that does not currently exist, it will be created before returning the mapping.

func (*PointsWriter) Open

func (w *PointsWriter) Open() error

Open opens the communication channel with the point writer.

func (*PointsWriter) Statistics

func (w *PointsWriter) Statistics(tags map[string]string) []models.Statistic

Statistics returns statistics for periodic monitoring.

func (*PointsWriter) WithLogger

func (w *PointsWriter) WithLogger(log *zap.Logger)

WithLogger sets the Logger on w.

func (*PointsWriter) WritePoints

func (w *PointsWriter) WritePoints(database, retentionPolicy string, consistencyLevel models.ConsistencyLevel, user meta.User, points []models.Point) error

WritePoints writes data to the underlying storage. consistencyLevel and user are only used for clustered scenarios.

func (*PointsWriter) WritePointsInto

func (w *PointsWriter) WritePointsInto(p *IntoWriteRequest) error

WritePointsInto is a copy of WritePoints that uses a tsdb structure instead of a cluster structure for information. This is to avoid a circular dependency.

func (*PointsWriter) WritePointsPrivileged

func (w *PointsWriter) WritePointsPrivileged(database, retentionPolicy string, consistencyLevel models.ConsistencyLevel, points []models.Point) error

WritePointsPrivileged writes the data to the underlying storage, consistencyLevel is only used for clustered scenarios

type Service

type Service struct {
	Listener net.Listener

	MetaClient interface {
		ShardOwner(shardID uint64) (string, string, *meta.ShardGroupInfo)
	}

	TSDBStore TSDBStore

	Logger *zap.Logger
	// contains filtered or unexported fields
}

Service processes data received over raw TCP connections.

func NewService

func NewService(c Config) *Service

NewService returns a new instance of Service.

func (*Service) Close

func (s *Service) Close() error

Close shuts down the listener and waits for all connections to finish.

func (*Service) Open

func (s *Service) Open() error

Open opens the network listener and begins serving requests.

func (*Service) WithLogger

func (s *Service) WithLogger(log *zap.Logger)

WithLogger sets the logger on the service.

type ShardIteratorCreator

type ShardIteratorCreator interface {
	ShardIteratorCreator(id uint64) query.IteratorCreator
}

ShardIteratorCreator is an interface for creating an IteratorCreator to access a specific shard.

type ShardMapping

type ShardMapping struct {
	Points  map[uint64][]models.Point  // The points associated with a shard ID
	Shards  map[uint64]*meta.ShardInfo // The shards that have been mapped, keyed by shard ID
	Dropped []models.Point             // Points that were dropped
	// contains filtered or unexported fields
}

ShardMapping contains a mapping of shards to points.

func NewShardMapping

func NewShardMapping(n int) *ShardMapping

NewShardMapping creates an empty ShardMapping.

func (*ShardMapping) MapPoint

func (s *ShardMapping) MapPoint(shardInfo *meta.ShardInfo, p models.Point)

MapPoint adds the point to the ShardMapping, associated with the given shardInfo.

type ShardWriter

type ShardWriter struct {
	MetaClient interface {
		DataNode(id uint64) (ni *meta.NodeInfo, err error)
		ShardOwner(shardID uint64) (database, rp string, sgi *meta.ShardGroupInfo)
	}
	// contains filtered or unexported fields
}

ShardWriter writes a set of points to a shard.

func NewShardWriter

func NewShardWriter(timeout time.Duration, maxConnections int) *ShardWriter

NewShardWriter returns a new instance of ShardWriter.

func (*ShardWriter) Close

func (w *ShardWriter) Close() error

Close closes ShardWriter's pool

func (*ShardWriter) WriteShard

func (w *ShardWriter) WriteShard(shardID, ownerID uint64, points []models.Point) error

WriteShard writes time series points to a shard

type Source

type Source struct {
	Database        string
	RetentionPolicy string
}

Source contains the database and retention policy source for data.

type StatementExecutor

type StatementExecutor struct {
	MetaClient MetaClient

	// TaskManager holds the StatementExecutor that handles task-related commands.
	TaskManager query.StatementExecutor

	// TSDB storage for local node.
	TSDBStore TSDBStore

	// ShardMapper for mapping shards when executing a SELECT statement.
	ShardMapper query.ShardMapper

	// Holds monitoring data for SHOW STATS and SHOW DIAGNOSTICS.
	Monitor *monitor.Monitor

	// Used for rewriting points back into system for SELECT INTO statements.
	PointsWriter interface {
		WritePointsInto(*IntoWriteRequest) error
	}

	// Select statement limits
	MaxSelectPointN   int
	MaxSelectSeriesN  int
	MaxSelectBucketsN int
}

StatementExecutor executes a statement in the query.

func (*StatementExecutor) ExecuteStatement

func (e *StatementExecutor) ExecuteStatement(ctx *query.ExecutionContext, stmt cnosql.Statement) error

ExecuteStatement executes the given statement with the given execution context.

func (*StatementExecutor) NormalizeStatement

func (e *StatementExecutor) NormalizeStatement(stmt cnosql.Statement, defaultDatabase, defaultRetentionPolicy string) (err error)

NormalizeStatement adds a default database and retention policy to the measurements in statement. Parameter defaultRetentionPolicy can be "".

type TSDBStore

type TSDBStore interface {
	CreateShard(database, rp string, shardID uint64, enabled bool) error
	WriteToShard(shardID uint64, points []models.Point) error

	RestoreShard(id uint64, r io.Reader) error
	BackupShard(id uint64, since time.Time, w io.Writer) error

	DeleteDatabase(name string) error
	DeleteMeasurement(database, name string) error
	DeleteRetentionPolicy(database, name string) error
	DeleteSeries(database string, sources []cnosql.Source, condition cnosql.Expr) error
	DeleteShard(id uint64) error

	MeasurementNames(auth query.FineAuthorizer, database string, cond cnosql.Expr) ([][]byte, error)
	TagKeys(auth query.FineAuthorizer, shardIDs []uint64, cond cnosql.Expr) ([]tsdb.TagKeys, error)
	TagValues(auth query.FineAuthorizer, shardIDs []uint64, cond cnosql.Expr) ([]tsdb.TagValues, error)

	// Use the context.Background() to avoid timing out on this.
	SeriesCardinality(ctx context.Context, database string) (int64, error)
	MeasurementsCardinality(ctx context.Context, database string) (int64, error)

	ShardGroup(ids []uint64) tsdb.ShardGroup
}

TSDBStore is an interface for accessing the time series data store.

type WritePointsRequest

type WritePointsRequest struct {
	Database         string
	RetentionPolicy  string
	ConsistencyLevel models.ConsistencyLevel
	Points           []models.Point
}

WritePointsRequest represents a request to write point data to the cluster.

func (*WritePointsRequest) AddPoint

func (w *WritePointsRequest) AddPoint(name string, value interface{}, timestamp time.Time, tags map[string]string)

AddPoint adds a point to the WritePointRequest with field key 'value'

type WriteShardRequest

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

WriteShardRequest represents the a request to write a slice of points to a shard

func (*WriteShardRequest) AddPoint

func (w *WriteShardRequest) AddPoint(name string, value interface{}, timestamp time.Time, tags map[string]string)

AddPoint adds a new time series point

func (*WriteShardRequest) AddPoints

func (w *WriteShardRequest) AddPoints(points []models.Point)

AddPoints adds a new time series point

func (*WriteShardRequest) Database

func (w *WriteShardRequest) Database() string

func (*WriteShardRequest) MarshalBinary

func (w *WriteShardRequest) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object to a binary format.

func (*WriteShardRequest) Points

func (w *WriteShardRequest) Points() []models.Point

Points returns the time series Points

func (*WriteShardRequest) RetentionPolicy

func (w *WriteShardRequest) RetentionPolicy() string

func (*WriteShardRequest) SetDatabase

func (w *WriteShardRequest) SetDatabase(db string)

func (*WriteShardRequest) SetRetentionPolicy

func (w *WriteShardRequest) SetRetentionPolicy(rp string)

func (*WriteShardRequest) SetShardID

func (w *WriteShardRequest) SetShardID(id uint64)

SetShardID sets the ShardID

func (*WriteShardRequest) ShardID

func (w *WriteShardRequest) ShardID() uint64

ShardID gets the ShardID

func (*WriteShardRequest) UnmarshalBinary

func (w *WriteShardRequest) UnmarshalBinary(buf []byte) error

UnmarshalBinary populates WritePointRequest from a binary format.

type WriteShardResponse

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

WriteShardResponse represents the response returned from a remote WriteShardRequest call

func (*WriteShardResponse) Code

func (w *WriteShardResponse) Code() int

Code returns the Code

func (*WriteShardResponse) MarshalBinary

func (w *WriteShardResponse) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object to a binary format.

func (*WriteShardResponse) Message

func (w *WriteShardResponse) Message() string

Message returns the Message

func (*WriteShardResponse) SetCode

func (w *WriteShardResponse) SetCode(code int)

SetCode sets the Code

func (*WriteShardResponse) SetMessage

func (w *WriteShardResponse) SetMessage(message string)

SetMessage sets the Message

func (*WriteShardResponse) UnmarshalBinary

func (w *WriteShardResponse) UnmarshalBinary(buf []byte) error

UnmarshalBinary populates WritePointRequest from a binary format.

type WriteStatistics

type WriteStatistics struct {
	WriteReq            int64
	PointWriteReq       int64
	PointWriteReqLocal  int64
	PointWriteReqRemote int64
	WriteOK             int64
	WritePartial        int64
	WriteDropped        int64
	WriteTimeout        int64
	WriteErr            int64
	WritePointReqHH     int64
	SubWriteOK          int64
	SubWriteDrop        int64
}

WriteStatistics keeps statistics related to the PointsWriter.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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