Documentation ¶
Index ¶
- Constants
- Variables
- type BufferedPointsWriter
- type Config
- type IntoWriteRequest
- type LocalTSDBStore
- type MetaClient
- type PointsWriter
- func (w *PointsWriter) Close() error
- func (w *PointsWriter) MapShards(wp *WritePointsRequest) (*ShardMapping, error)
- func (w *PointsWriter) Open() error
- func (w *PointsWriter) SetLogOutput(lw io.Writer)
- func (w *PointsWriter) WritePoints(database, retentionPolicy string, consistencyLevel models.ConsistencyLevel, ...) error
- func (w *PointsWriter) WritePointsInto(p *IntoWriteRequest) error
- type ShardIteratorCreator
- type ShardMapping
- type StatementExecutor
- type TSDBStore
- type WritePointsRequest
Constants ¶
const ( // DefaultWriteTimeout is the default timeout for a complete write to succeed. DefaultWriteTimeout = 10 * time.Second // 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 )
Variables ¶
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") )
Functions ¶
This section is empty.
Types ¶
type BufferedPointsWriter ¶ added in v1.0.0
type BufferedPointsWriter struct {
// contains filtered or unexported fields
}
func NewBufferedPointsWriter ¶ added in v1.0.0
func NewBufferedPointsWriter(w pointsWriter, database, retentionPolicy string, capacity int) *BufferedPointsWriter
func (*BufferedPointsWriter) Cap ¶ added in v1.0.0
func (w *BufferedPointsWriter) Cap() int
Cap returns the capacity (in points) of the buffer.
func (*BufferedPointsWriter) Flush ¶ added in v1.0.0
func (w *BufferedPointsWriter) Flush() error
Flush writes all buffered points to the underlying writer.
func (*BufferedPointsWriter) Len ¶ added in v1.0.0
func (w *BufferedPointsWriter) Len() int
Len returns the number of points buffered.
func (*BufferedPointsWriter) WritePointsInto ¶ added in v1.0.0
func (w *BufferedPointsWriter) WritePointsInto(req *IntoWriteRequest) error
type Config ¶ added in v1.0.0
type Config struct { WriteTimeout toml.Duration `toml:"write-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 clustering service.
type IntoWriteRequest ¶ added in v1.0.0
IntoWriteRequest is a partial copy of cluster.WriteRequest
type LocalTSDBStore ¶ added in v1.0.0
func (LocalTSDBStore) IteratorCreator ¶ added in v1.0.0
func (s LocalTSDBStore) IteratorCreator(shards []meta.ShardInfo) (influxql.IteratorCreator, error)
type MetaClient ¶ added in v1.0.0
type MetaClient interface { CreateContinuousQuery(database, name, query string) error CreateDatabase(name string) (*meta.DatabaseInfo, error) CreateDatabaseWithRetentionPolicy(name string, rpi *meta.RetentionPolicyInfo) (*meta.DatabaseInfo, error) CreateRetentionPolicy(database string, rpi *meta.RetentionPolicyInfo) (*meta.RetentionPolicyInfo, error) CreateSubscription(database, rp, name, mode string, destinations []string) error CreateUser(name, password string, admin bool) (*meta.UserInfo, error) Database(name string) *meta.DatabaseInfo Databases() []meta.DatabaseInfo 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 RetentionPolicy(database, name string) (rpi *meta.RetentionPolicyInfo, err error) SetAdminPrivilege(username string, admin bool) error SetDefaultRetentionPolicy(database, name string) error SetPrivilege(username, database string, p influxql.Privilege) error ShardsByTimeRange(sources influxql.Sources, tmin, tmax time.Time) (a []meta.ShardInfo, err error) UpdateRetentionPolicy(database, name string, rpu *meta.RetentionPolicyUpdate) error UpdateUser(name, password string) error UserPrivilege(username, database string) (*influxql.Privilege, error) UserPrivileges(username string) (map[string]influxql.Privilege, error) Users() []meta.UserInfo }
MetaClient is an interface for accessing meta data.
type PointsWriter ¶ added in v1.0.0
type PointsWriter struct { WriteTimeout time.Duration Logger *log.Logger Node *influxdb.Node MetaClient interface { Database(name string) (di *meta.DatabaseInfo) RetentionPolicy(database, policy string) (*meta.RetentionPolicyInfo, error) CreateShardGroup(database, policy string, timestamp time.Time) (*meta.ShardGroupInfo, error) ShardOwner(shardID uint64) (string, string, *meta.ShardGroupInfo) } 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 } Subscriber interface { Points() chan<- *WritePointsRequest } // contains filtered or unexported fields }
PointsWriter handles writes across multiple local and remote data nodes.
func NewPointsWriter ¶ added in v1.0.0
func NewPointsWriter() *PointsWriter
NewPointsWriter returns a new instance of PointsWriter for a node.
func (*PointsWriter) Close ¶ added in v1.0.0
func (w *PointsWriter) Close() error
Close closes the communication channel with the point writer
func (*PointsWriter) MapShards ¶ added in v1.0.0
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 ¶ added in v1.0.0
func (w *PointsWriter) Open() error
Open opens the communication channel with the point writer
func (*PointsWriter) SetLogOutput ¶ added in v1.0.0
func (w *PointsWriter) SetLogOutput(lw io.Writer)
SetLogOutput sets the writer to which all logs are written. It must not be called after Open is called.
func (*PointsWriter) WritePoints ¶ added in v1.0.0
func (w *PointsWriter) WritePoints(database, retentionPolicy string, consistencyLevel models.ConsistencyLevel, points []models.Point) error
WritePoints writes across multiple local and remote data nodes according the consistency level.
func (*PointsWriter) WritePointsInto ¶ added in v1.0.0
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
type ShardIteratorCreator ¶ added in v1.0.0
type ShardIteratorCreator interface {
ShardIteratorCreator(id uint64) influxql.IteratorCreator
}
ShardIteratorCreator is an interface for creating an IteratorCreator to access a specific shard.
type ShardMapping ¶ added in v1.0.0
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 }
ShardMapping contains a mapping of a shards to a points.
func NewShardMapping ¶ added in v1.0.0
func NewShardMapping() *ShardMapping
NewShardMapping creates an empty ShardMapping
type StatementExecutor ¶ added in v1.0.0
type StatementExecutor struct { MetaClient MetaClient // TSDB storage for local node. TSDBStore TSDBStore // Holds monitoring data for SHOW STATS and SHOW DIAGNOSTICS. Monitor *monitor.Monitor // Used for rewriting points back into system for SELECT INTO statements. PointsWriter pointsWriter // Select statement limits MaxSelectPointN int MaxSelectSeriesN int MaxSelectBucketsN int }
StatementExecutor executes a statement in the query.
func (*StatementExecutor) ExecuteStatement ¶ added in v1.0.0
func (e *StatementExecutor) ExecuteStatement(stmt influxql.Statement, ctx *influxql.ExecutionContext) error
func (*StatementExecutor) NormalizeStatement ¶ added in v1.0.0
func (e *StatementExecutor) NormalizeStatement(stmt influxql.Statement, defaultDatabase string) (err error)
NormalizeStatement adds a default database and policy to the measurements in statement.
type TSDBStore ¶ added in v1.0.0
type TSDBStore interface { CreateShard(database, policy 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 []influxql.Source, condition influxql.Expr) error DeleteShard(id uint64) error DatabaseIndex(name string) *tsdb.DatabaseIndex IteratorCreator(shards []meta.ShardInfo) (influxql.IteratorCreator, error) ShardIteratorCreator(id uint64) influxql.IteratorCreator }
TSDBStore is an interface for accessing the time series data store.
type WritePointsRequest ¶ added in v1.0.0
WritePointsRequest represents a request to write point data to the cluster