Documentation ¶
Index ¶
- Constants
- Variables
- func HashPassword(password string) ([]byte, error)
- func NopWriteToCloser(w io.WriterTo) interface{ ... }
- type Broker
- type BuildDiagnostics
- type ContinuousQuery
- type DataNode
- type ErrAuthorize
- type Field
- type FieldCodec
- func (f *FieldCodec) DecodeByID(targetID uint8, b []byte) (interface{}, error)
- func (f *FieldCodec) DecodeFields(b []byte) map[uint8]interface{}
- func (f *FieldCodec) DecodeFieldsWithNames(b []byte) map[string]interface{}
- func (f *FieldCodec) EncodeFields(values map[string]interface{}) ([]byte, error)
- func (f *FieldCodec) FieldByName(name string) *Field
- type Fields
- type GoDiagnostics
- type Int
- type LocalMapper
- type Matcher
- type Measurement
- type Measurements
- type MemoryDiagnostics
- type MessagingClient
- type MessagingConn
- type Point
- type Result
- type Results
- type RetentionPolicies
- type RetentionPolicy
- type RetentionPolicyUpdate
- type Series
- type Server
- func (s *Server) AdminUserExists() bool
- func (s *Server) Authenticate(username, password string) (*User, error)
- func (s *Server) Authorize(u *User, q *influxql.Query, database string) error
- func (s *Server) Begin() (influxql.Tx, error)
- func (s *Server) Client() MessagingClient
- func (s *Server) Close() error
- func (s *Server) ContinuousQueries(database string) []*ContinuousQuery
- func (s *Server) CopyMetastore(w io.Writer) error
- func (s *Server) CreateContinuousQuery(q *influxql.CreateContinuousQueryStatement) error
- func (s *Server) CreateDataNode(u *url.URL) error
- func (s *Server) CreateDatabase(name string) error
- func (s *Server) CreateDatabaseIfNotExists(name string) error
- func (s *Server) CreateRetentionPolicy(database string, rp *RetentionPolicy) error
- func (s *Server) CreateRetentionPolicyIfNotExists(database string, rp *RetentionPolicy) error
- func (s *Server) CreateShardGroupIfNotExists(database, policy string, timestamp time.Time) error
- func (s *Server) CreateSnapshotWriter() (*SnapshotWriter, error)
- func (s *Server) CreateUser(username, password string, admin bool) error
- func (s *Server) DataNode(id uint64) *DataNode
- func (s *Server) DataNodeByURL(u *url.URL) *DataNode
- func (s *Server) DataNodes() (a []*DataNode)
- func (s *Server) DatabaseExists(name string) bool
- func (s *Server) Databases() (a []string)
- func (s *Server) DefaultRetentionPolicy(database string) (*RetentionPolicy, error)
- func (s *Server) DeleteDataNode(id uint64) error
- func (s *Server) DeleteRetentionPolicy(database, name string) error
- func (s *Server) DeleteShardGroup(database, policy string, shardID uint64) error
- func (s *Server) DeleteUser(username string) error
- func (s *Server) DiagnosticsAsRows() []*influxql.Row
- func (s *Server) DropContinuousQuery(q *influxql.DropContinuousQueryStatement) error
- func (s *Server) DropDatabase(name string) error
- func (s *Server) DropMeasurement(database, name string) error
- func (s *Server) DropSeries(database string, seriesByMeasurement map[string][]uint32) error
- func (s *Server) EnforceRetentionPolicies()
- func (s *Server) ExecuteQuery(q *influxql.Query, database string, user *User) Results
- func (s *Server) ID() uint64
- func (s *Server) Index() uint64
- func (s *Server) Initialize(u url.URL) error
- func (s *Server) Join(u *url.URL, joinURL *url.URL) error
- func (s *Server) MeasurementNames(database string) []string
- func (s *Server) NormalizeMeasurement(m *influxql.Measurement, defaultDatabase string) (*influxql.Measurement, error)
- func (s *Server) NormalizeStatement(stmt influxql.Statement, defaultDatabase string) (err error)
- func (s *Server) Open(path string, client MessagingClient) error
- func (s *Server) Path() string
- func (s *Server) ReadSeries(database, retentionPolicy, name string, tags map[string]string, ...) (map[string]interface{}, error)
- func (s *Server) RetentionPolicies(database string) ([]*RetentionPolicy, error)
- func (s *Server) RetentionPolicy(database, name string) (*RetentionPolicy, error)
- func (s *Server) RetentionPolicyExists(database, retention string) bool
- func (s *Server) RunContinuousQueries() error
- func (s *Server) SetAuthenticationEnabled(enabled bool)
- func (s *Server) SetDefaultRetentionPolicy(database, name string) error
- func (s *Server) SetPrivilege(p influxql.Privilege, username string, dbname string) error
- func (s *Server) Shard(id uint64) *Shard
- func (s *Server) ShardGroupPreCreate(checkInterval time.Duration)
- func (s *Server) ShardGroups(database string) ([]*ShardGroup, error)
- func (s *Server) StartReportingLoop(clusterID uint64) chan struct{}
- func (s *Server) StartRetentionPolicyEnforcement(checkInterval time.Duration) error
- func (s *Server) StartSelfMonitoring(database, retention string, interval time.Duration) error
- func (s *Server) StartShardGroupsPreCreate(checkInterval time.Duration) error
- func (s *Server) Sync(topicID, index uint64) error
- func (s *Server) UpdateRetentionPolicy(database, name string, rpu *RetentionPolicyUpdate) error
- func (s *Server) UpdateUser(username, password string) error
- func (s *Server) User(name string) *User
- func (s *Server) UserCount() int
- func (s *Server) Users() (a []*User)
- func (s *Server) WriteSeries(database, retentionPolicy string, points []Point) (idx uint64, err error)
- type Shard
- type ShardGroup
- type Shards
- type Snapshot
- type SnapshotFile
- type SnapshotFileWriter
- type SnapshotFiles
- type SnapshotReader
- type SnapshotWriter
- type SnapshotsReader
- type Stats
- func (s *Stats) Add(key string, delta int64)
- func (s *Stats) Diff(other *Stats) *Stats
- func (s *Stats) Get(key string) int64
- func (s *Stats) Inc(key string)
- func (s *Stats) Name() string
- func (s *Stats) Set(key string, v int64)
- func (s *Stats) Snapshot() *Stats
- func (s *Stats) Walk(f func(string, int64))
- type SystemDiagnostics
- type TagFilter
- type User
Constants ¶
const ( // DefaultContinuousQueryCheckTime is how frequently the broker will ask a data node // in the cluster to run any continuous queries that should be run. DefaultContinuousQueryCheckTime = 1 * time.Second // DefaultDataNodeTimeout is how long the broker will wait before timing out on a data node // that it has requested process continuous queries. DefaultDataNodeTimeout = 1 * time.Second // DefaultFailureSleep is how long the broker will sleep before trying the next data node in // the cluster if the current data node failed to respond DefaultFailureSleep = 100 * time.Millisecond )
const ( // DefaultRootPassword is the password initially set for the root user. // It is also used when reseting the root user's password. DefaultRootPassword = "root" // DefaultRetentionPolicyName is the name of a databases's default shard space. DefaultRetentionPolicyName = "default" // DefaultSplitN represents the number of partitions a shard is split into. DefaultSplitN = 1 // DefaultReplicaN represents the number of replicas data is written to. DefaultReplicaN = 1 // DefaultShardDuration is the time period held by a shard. DefaultShardDuration = 7 * (24 * time.Hour) // DefaultShardRetention is the length of time before a shard is dropped. DefaultShardRetention = 7 * (24 * time.Hour) // BroadcastTopicID is the topic used for all metadata. BroadcastTopicID = uint64(0) )
Variables ¶
var ( // ErrServerOpen is returned when opening an already open server. ErrServerOpen = errors.New("server already open") // ErrServerClosed is returned when closing an already closed server. ErrServerClosed = errors.New("server already closed") // ErrPathRequired is returned when opening a server without a path. ErrPathRequired = errors.New("path required") // ErrUnableToJoin is returned when a server cannot join a cluster. ErrUnableToJoin = errors.New("unable to join") // ErrDataNodeURLRequired is returned when creating a data node without a URL. ErrDataNodeURLRequired = errors.New("data node url required") // ErrDataNodeExists is returned when creating a duplicate data node. ErrDataNodeExists = errors.New("data node exists") // ErrDataNodeNotFound is returned when dropping a non-existent data node. ErrDataNodeNotFound = errors.New("data node not found") // ErrDataNodeRequired is returned when using a blank data node id. ErrDataNodeRequired = errors.New("data node required") // ErrDatabaseNameRequired is returned when creating a database without a name. ErrDatabaseNameRequired = errors.New("database name required") // ErrDatabaseExists is returned when creating a duplicate database. ErrDatabaseExists = errors.New("database exists") // ErrDatabaseNotFound is returned when dropping a non-existent database. ErrDatabaseNotFound = errors.New("database not found") // ErrDatabaseRequired is returned when using a blank database name. ErrDatabaseRequired = errors.New("database required") // ErrClusterAdminExists is returned when creating a duplicate admin. ErrClusterAdminExists = errors.New("cluster admin exists") // ErrClusterAdminNotFound is returned when deleting a non-existent admin. ErrClusterAdminNotFound = errors.New("cluster admin not found") // ErrUserExists is returned when creating a duplicate user. ErrUserExists = errors.New("user exists") // ErrUserNotFound is returned when deleting a non-existent user. ErrUserNotFound = errors.New("user not found") // ErrUsernameRequired is returned when using a blank username. ErrUsernameRequired = errors.New("username required") // ErrInvalidUsername is returned when using a username with invalid characters. ErrInvalidUsername = errors.New("invalid username") // ErrRetentionPolicyExists is returned when creating a duplicate shard space. ErrRetentionPolicyExists = errors.New("retention policy exists") // ErrRetentionPolicyNotFound is returned when deleting a non-existent shard space. ErrRetentionPolicyNotFound = errors.New("retention policy not found") // ErrRetentionPolicyNameRequired is returned using a blank shard space name. ErrRetentionPolicyNameRequired = errors.New("retention policy name required") // ErrRetentionPolicyMinDuration is returned when creating replication policy with a duration smaller than RetenionPolicyMinDuration. ErrRetentionPolicyMinDuration = fmt.Errorf("retention policy duration needs to be at least %s", retentionPolicyMinDuration) // ErrDefaultRetentionPolicyNotFound is returned when using the default // policy on a database but the default has not been set. ErrDefaultRetentionPolicyNotFound = errors.New("default retention policy not found") // ErrShardNotFound is returned writing to a non-existent shard. ErrShardNotFound = errors.New("shard not found") // ErrInvalidPointBuffer is returned when a buffer containing data for writing is invalid ErrInvalidPointBuffer = errors.New("invalid point buffer") // ErrReadAccessDenied is returned when a user attempts to read // data that he or she does not have permission to read. ErrReadAccessDenied = errors.New("read access denied") // ErrReadWritePermissionsRequired is returned when required read/write permissions aren't provided. ErrReadWritePermissionsRequired = errors.New("read/write permissions required") // ErrInvalidQuery is returned when executing an unknown query type. ErrInvalidQuery = errors.New("invalid query") // ErrMeasurementNameRequired is returned when a point does not contain a name. ErrMeasurementNameRequired = errors.New("measurement name required") // ErrMeasurementNotFound is returned when a measurement does not exist. ErrMeasurementNotFound = errors.New("measurement not found") // ErrFieldsRequired is returned when a point does not any fields. ErrFieldsRequired = errors.New("fields required") // ErrFieldOverflow is returned when too many fields are created on a measurement. ErrFieldOverflow = errors.New("field overflow") // ErrFieldTypeConflict is returned when a new field already exists with a different type. ErrFieldTypeConflict = errors.New("field type conflict") // ErrFieldNotFound is returned when a field cannot be found. ErrFieldNotFound = errors.New("field not found") // ErrSeriesNotFound is returned when looking up a non-existent series by database, name and tags ErrSeriesNotFound = errors.New("series not found") // ErrSeriesExists is returned when attempting to set the id of a series by database, name and tags that already exists ErrSeriesExists = errors.New("series already exists") // ErrNotExecuted is returned when a statement is not executed in a query. // This can occur when a previous statement in the same query has errored. ErrNotExecuted = errors.New("not executed") // ErrInvalidGrantRevoke is returned when a statement requests an invalid // privilege for a user on the cluster or a database. ErrInvalidGrantRevoke = errors.New("invalid privilege requested") // ErrContinuousQueryExists is returned when creating a duplicate continuous query. ErrContinuousQueryExists = errors.New("continuous query already exists") // ErrContinuousQueryNotFound is returned when dropping a nonexistent continuous query. ErrContinuousQueryNotFound = errors.New("continuous query not found") )
var BcryptCost = 10
BcryptCost is the cost associated with generating password with Bcrypt. This setting is lowered during testing to improve test suite performance.
Functions ¶
func HashPassword ¶
HashPassword generates a cryptographically secure hash for password. Returns an error if the password is invalid or a hash cannot be generated.
Types ¶
type Broker ¶
type Broker struct { *messaging.Broker // variables to control when to trigger processing and when to timeout TriggerInterval time.Duration TriggerTimeout time.Duration TriggerFailurePause time.Duration // contains filtered or unexported fields }
Broker represents an InfluxDB specific messaging broker.
func NewBroker ¶
func NewBroker() *Broker
NewBroker returns a new instance of a Broker with default values.
func (*Broker) RunContinuousQueryLoop ¶
func (b *Broker) RunContinuousQueryLoop()
RunContinuousQueryLoop starts running continuous queries on a background goroutine.
type BuildDiagnostics ¶
BuildDiagnostics capture basic build version information.
type ContinuousQuery ¶
type ContinuousQuery struct { Query string `json:"query"` // contains filtered or unexported fields }
ContinuousQuery represents a query that exists on the server and processes each incoming event.
func NewContinuousQuery ¶
func NewContinuousQuery(q string) (*ContinuousQuery, error)
NewContinuousQuery returns a ContinuousQuery object with a parsed influxql.CreateContinuousQueryStatement
type ErrAuthorize ¶
type ErrAuthorize struct {
// contains filtered or unexported fields
}
ErrAuthorize represents an authorization error.
func (ErrAuthorize) Error ¶
func (e ErrAuthorize) Error() string
Error returns the text of the error.
type Field ¶
type Field struct { ID uint8 `json:"id,omitempty"` Name string `json:"name,omitempty"` Type influxql.DataType `json:"type,omitempty"` }
Field represents a series field.
type FieldCodec ¶
type FieldCodec struct {
// contains filtered or unexported fields
}
FieldCodec providecs encoding and decoding functionality for the fields of a given Measurement. It is a distinct type to avoid locking writes on this node while potentially long-running queries are executing.
It is not affected by changes to the Measurement object after codec creation.
func NewFieldCodec ¶
func NewFieldCodec(m *Measurement) *FieldCodec
NewFieldCodec returns a FieldCodec for the given Measurement. Must be called with a RLock that protects the Measurement.
func (*FieldCodec) DecodeByID ¶
func (f *FieldCodec) DecodeByID(targetID uint8, b []byte) (interface{}, error)
DecodeByID scans a byte slice for a field with the given ID, converts it to its expected type, and return that value.
func (*FieldCodec) DecodeFields ¶
func (f *FieldCodec) DecodeFields(b []byte) map[uint8]interface{}
DecodeFields decodes a byte slice into a set of field ids and values.
func (*FieldCodec) DecodeFieldsWithNames ¶
func (f *FieldCodec) DecodeFieldsWithNames(b []byte) map[string]interface{}
DecodeFieldsWithNames decodes a byte slice into a set of field names and values
func (*FieldCodec) EncodeFields ¶
func (f *FieldCodec) EncodeFields(values map[string]interface{}) ([]byte, error)
EncodeFields converts a map of values with string keys to a byte slice of field IDs and values.
If a field exists in the codec, but its type is different, an error is returned. If a field is not present in the codec, the system panics.
func (*FieldCodec) FieldByName ¶
func (f *FieldCodec) FieldByName(name string) *Field
FieldByName returns the field by its name. It will return a nil if not found
type GoDiagnostics ¶
GoDiagnostics captures basic information about the runtime.
func NewGoDiagnostics ¶
func NewGoDiagnostics() *GoDiagnostics
NewGoDiagnostics returns a GoDiagnostics object.
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
Int representes a 64-bit signed integer which can be updated atomically.
type LocalMapper ¶
type LocalMapper struct {
// contains filtered or unexported fields
}
LocalMapper implements the influxql.Mapper interface for running map tasks over a shard that is local to this server
func (*LocalMapper) Begin ¶
func (l *LocalMapper) Begin(c *influxql.Call, startingTime int64) error
Begin will set up the mapper to run the map function for a given aggregate call starting at the passed in time
func (*LocalMapper) Next ¶
func (l *LocalMapper) Next() (seriesID uint32, timestamp int64, value interface{})
Next returns the next matching timestamped value for the LocalMapper.
func (*LocalMapper) NextInterval ¶
func (l *LocalMapper) NextInterval(interval int64) (interface{}, error)
NextInterval will get the time ordered next interval of the given interval size from the mapper. This is a forward only operation from the start time passed into Begin. Will return nil when there is no more data to be read.
type Measurement ¶
type Measurement struct { Name string `json:"name,omitempty"` Fields []*Field `json:"fields,omitempty"` // contains filtered or unexported fields }
Measurement represents a collection of time series in a database. It also contains in memory structures for indexing tags. These structures are accessed through private methods on the Measurement object. Generally these methods are only accessed from Index, which is responsible for ensuring go routine safe access.
func NewMeasurement ¶
func NewMeasurement(name string) *Measurement
NewMeasurement allocates and initializes a new Measurement.
func (*Measurement) Field ¶
func (m *Measurement) Field(id uint8) *Field
Field returns a field by id.
func (*Measurement) FieldByName ¶
func (m *Measurement) FieldByName(name string) *Field
FieldByName returns a field by name.
func (*Measurement) HasTagKey ¶
func (m *Measurement) HasTagKey(k string) bool
HasTagKey returns true if at least one eries in this measurement has written a value for the passed in tag key
type Measurements ¶
type Measurements []*Measurement
Measurements represents a list of *Measurement.
func (Measurements) Len ¶
func (a Measurements) Len() int
func (Measurements) Less ¶
func (a Measurements) Less(i, j int) bool
func (Measurements) Swap ¶
func (a Measurements) Swap(i, j int)
type MemoryDiagnostics ¶
type MemoryDiagnostics struct { Alloc int TotalAlloc int Sys int Lookups int Mallocs int Frees int HeapAlloc int HeapSys int HeapIdle int HeapInUse int HeapReleased int HeapObjects int PauseTotalNs int NumGC int }
MemoryDiagnostics captures Go memory stats.
func NewMemoryDiagnostics ¶
func NewMemoryDiagnostics() *MemoryDiagnostics
NewMemoryDiagnostics returns a MemoryDiagnostics object.
type MessagingClient ¶
type MessagingClient interface { Open(path string) error Close() error // Retrieves or sets the current list of broker URLs. URLs() []url.URL SetURLs([]url.URL) // Publishes a message to the broker. Publish(m *messaging.Message) (index uint64, err error) // Conn returns an open, streaming connection to a topic. Conn(topicID uint64) MessagingConn }
MessagingClient represents the client used to connect to brokers.
func NewMessagingClient ¶
func NewMessagingClient() MessagingClient
NewMessagingClient returns an instance of MessagingClient.
type MessagingConn ¶
type MessagingConn interface { Open(index uint64, streaming bool) error C() <-chan *messaging.Message }
MessagingConn represents a streaming connection to a single broker topic.
type Point ¶
type Point struct { Name string Tags map[string]string Timestamp time.Time Fields map[string]interface{} }
Point defines the values that will be written to the database
func NormalizeBatchPoints ¶
func NormalizeBatchPoints(bp client.BatchPoints) ([]Point, error)
NormalizeBatchPoints returns a slice of Points, created by populating individual points within the batch, which do not have timestamps or tags, with the top-level values.
type Result ¶
Result represents a resultset returned from a single statement.
func (*Result) MarshalJSON ¶
MarshalJSON encodes the result into JSON.
func (*Result) UnmarshalJSON ¶
UnmarshalJSON decodes the data into the Result struct
type Results ¶
Results represents a list of statement results.
func (*Results) Error ¶
Error returns the first error from any statement. Returns nil if no errors occurred on any statements.
func (Results) MarshalJSON ¶
MarshalJSON encodes a Results struct into JSON.
func (*Results) UnmarshalJSON ¶
UnmarshalJSON decodes the data into the Results struct
type RetentionPolicies ¶
type RetentionPolicies []*RetentionPolicy
RetentionPolicies represents a list of retention policies.
func (RetentionPolicies) Len ¶
func (a RetentionPolicies) Len() int
func (RetentionPolicies) Less ¶
func (a RetentionPolicies) Less(i, j int) bool
func (RetentionPolicies) Swap ¶
func (a RetentionPolicies) Swap(i, j int)
type RetentionPolicy ¶
type RetentionPolicy struct { // Unique name within database. Required. Name string `json:"name"` // Length of time to keep data around. A zero duration means keep the data forever. Duration time.Duration `json:"duration"` // Length of time to create shard groups in. ShardGroupDuration time.Duration `json:"shardGroupDuration"` // The number of copies to make of each shard. ReplicaN uint32 `json:"replicaN"` // contains filtered or unexported fields }
RetentionPolicy represents a policy for creating new shards in a database and how long they're kept around for.
func NewRetentionPolicy ¶
func NewRetentionPolicy(name string) *RetentionPolicy
NewRetentionPolicy returns a new instance of RetentionPolicy with defaults set.
func (*RetentionPolicy) MarshalJSON ¶
func (rp *RetentionPolicy) MarshalJSON() ([]byte, error)
MarshalJSON encodes a retention policy to a JSON-encoded byte slice.
func (*RetentionPolicy) UnmarshalJSON ¶
func (rp *RetentionPolicy) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes a JSON-encoded byte slice to a retention policy.
type RetentionPolicyUpdate ¶
type RetentionPolicyUpdate struct { Name *string `json:"name,omitempty"` Duration *time.Duration `json:"duration,omitempty"` ReplicaN *uint32 `json:"replicaN,omitempty"` }
RetentionPolicyUpdate represents retention policy fields that need to be updated.
type Server ¶
type Server struct { Logger *log.Logger WriteTrace bool // Detailed logging of write path // Retention policy settings RetentionAutoCreate bool // continuous query settings RecomputePreviousN int RecomputeNoOlderThan time.Duration ComputeRunsPerInterval int ComputeNoMoreThan time.Duration // Build information. Version string CommitHash string // contains filtered or unexported fields }
Server represents a collection of metadata and raw metric data.
func (*Server) AdminUserExists ¶
AdminUserExists returns whether at least 1 admin-level user exists.
func (*Server) Authenticate ¶
Authenticate returns an authenticated user by username. If any error occurs, or the authentication credentials are invalid, an error is returned.
func (*Server) Authorize ¶
Authorize user u to execute query q on database. database can be "" for queries that do not require a database. If u is nil, this means authorization is disabled.
func (*Server) Client ¶
func (s *Server) Client() MessagingClient
Client retrieves the current messaging client.
func (*Server) ContinuousQueries ¶
func (s *Server) ContinuousQueries(database string) []*ContinuousQuery
ContinuousQueries returns a list of all continuous queries.
func (*Server) CopyMetastore ¶
CopyMetastore writes the underlying metastore data file to a writer.
func (*Server) CreateContinuousQuery ¶
func (s *Server) CreateContinuousQuery(q *influxql.CreateContinuousQueryStatement) error
CreateContinuousQuery creates a continuous query.
func (*Server) CreateDataNode ¶
CreateDataNode creates a new data node with a given URL.
func (*Server) CreateDatabase ¶
CreateDatabase creates a new database.
func (*Server) CreateDatabaseIfNotExists ¶
CreateDatabaseIfNotExists creates a new database if, and only if, it does not exist already.
func (*Server) CreateRetentionPolicy ¶
func (s *Server) CreateRetentionPolicy(database string, rp *RetentionPolicy) error
CreateRetentionPolicy creates a retention policy for a database.
func (*Server) CreateRetentionPolicyIfNotExists ¶
func (s *Server) CreateRetentionPolicyIfNotExists(database string, rp *RetentionPolicy) error
CreateRetentionPolicyIfNotExists creates a retention policy for a database.
func (*Server) CreateShardGroupIfNotExists ¶
CreateShardGroupIfNotExists creates the shard group for a retention policy for the interval a timestamp falls into.
func (*Server) CreateSnapshotWriter ¶
func (s *Server) CreateSnapshotWriter() (*SnapshotWriter, error)
CreateSnapshotWriter returns a writer for the current snapshot.
func (*Server) CreateUser ¶
CreateUser creates a user on the server.
func (*Server) DataNodeByURL ¶
DataNodeByURL returns a data node by url.
func (*Server) DatabaseExists ¶
DatabaseExists returns true if a database exists.
func (*Server) DefaultRetentionPolicy ¶
func (s *Server) DefaultRetentionPolicy(database string) (*RetentionPolicy, error)
DefaultRetentionPolicy returns the default retention policy for a database. Returns an error if the database doesn't exist.
func (*Server) DeleteDataNode ¶
DeleteDataNode deletes an existing data node.
func (*Server) DeleteRetentionPolicy ¶
DeleteRetentionPolicy removes a retention policy from a database.
func (*Server) DeleteShardGroup ¶
DeleteShardGroup deletes the shard group identified by shardID.
func (*Server) DeleteUser ¶
DeleteUser removes a user from the server.
func (*Server) DiagnosticsAsRows ¶
DiagnosticsAsRows returns diagnostic information about the server, as a slice of InfluxQL rows.
func (*Server) DropContinuousQuery ¶
func (s *Server) DropContinuousQuery(q *influxql.DropContinuousQueryStatement) error
DropContinuousQuery dropsoa continuous query.
func (*Server) DropDatabase ¶
DropDatabase deletes an existing database.
func (*Server) DropMeasurement ¶
DropMeasurement drops a given measurement from a database.
func (*Server) DropSeries ¶
DropSeries deletes from an existing series.
func (*Server) EnforceRetentionPolicies ¶
func (s *Server) EnforceRetentionPolicies()
EnforceRetentionPolicies ensures that data that is aging-out due to retention policies is removed from the server.
func (*Server) ExecuteQuery ¶
ExecuteQuery executes an InfluxQL query against the server. Returns a resultset for each statement in the query. Stops on first execution error that occurs.
func (*Server) ID ¶
ID returns the data node id for the server. Returns zero if the server is closed or the server has not joined a cluster.
func (*Server) Initialize ¶
Initialize creates a new data node and initializes the server's id to 1.
func (*Server) Join ¶
Join creates a new data node in an existing cluster, copies the metastore, and initializes the ID.
func (*Server) MeasurementNames ¶
MeasurementNames returns a list of all measurements for the specified database.
func (*Server) NormalizeMeasurement ¶
func (s *Server) NormalizeMeasurement(m *influxql.Measurement, defaultDatabase string) (*influxql.Measurement, error)
NormalizeMeasurement inserts the default database or policy into all measurement names.
func (*Server) NormalizeStatement ¶
NormalizeStatement adds a default database and policy to the measurements in statement.
func (*Server) Open ¶
func (s *Server) Open(path string, client MessagingClient) error
Open initializes the server from a given path.
func (*Server) Path ¶
Path returns the path used when opening the server. Returns an empty string when the server is closed.
func (*Server) ReadSeries ¶
func (s *Server) ReadSeries(database, retentionPolicy, name string, tags map[string]string, timestamp time.Time) (map[string]interface{}, error)
ReadSeries reads a single point from a series in the database. It is used for debug and test only.
func (*Server) RetentionPolicies ¶
func (s *Server) RetentionPolicies(database string) ([]*RetentionPolicy, error)
RetentionPolicies returns a list of retention polocies for a database. Returns an error if the database doesn't exist.
func (*Server) RetentionPolicy ¶
func (s *Server) RetentionPolicy(database, name string) (*RetentionPolicy, error)
RetentionPolicy returns a retention policy by name. Returns an error if the database doesn't exist.
func (*Server) RetentionPolicyExists ¶
RetentionPolicyExists returns true if a retention policy exists for a given database.
func (*Server) RunContinuousQueries ¶
RunContinuousQueries will run any continuous queries that are due to run and write the results back into the database
func (*Server) SetAuthenticationEnabled ¶
SetAuthenticationEnabled turns on or off server authentication
func (*Server) SetDefaultRetentionPolicy ¶
SetDefaultRetentionPolicy sets the default policy to write data into and query from on a database.
func (*Server) SetPrivilege ¶
SetPrivilege grants / revokes a privilege to a user.
func (*Server) ShardGroupPreCreate ¶
ShardGroupPreCreate ensures that future shard groups and shards are created and ready for writing is removed from the server.
func (*Server) ShardGroups ¶
func (s *Server) ShardGroups(database string) ([]*ShardGroup, error)
ShardGroups returns a list of all shard groups for a database. Returns an error if the database doesn't exist.
func (*Server) StartReportingLoop ¶
StartReportingLoop starts the anonymous usage reporting loop for a given cluster ID.
func (*Server) StartRetentionPolicyEnforcement ¶
StartRetentionPolicyEnforcement launches retention policy enforcement.
func (*Server) StartSelfMonitoring ¶
StartSelfMonitoring starts a goroutine which monitors the InfluxDB server itself and stores the results in the specified database at a given interval.
func (*Server) StartShardGroupsPreCreate ¶
StartShardGroupsPreCreate launches shard group pre-create to avoid write bottlenecks.
func (*Server) Sync ¶
Sync blocks until a given index (or a higher index) has been applied. Returns any error associated with the command.
func (*Server) UpdateRetentionPolicy ¶
func (s *Server) UpdateRetentionPolicy(database, name string, rpu *RetentionPolicyUpdate) error
UpdateRetentionPolicy updates an existing retention policy on a database.
func (*Server) UpdateUser ¶
UpdateUser updates an existing user on the server.
type Shard ¶
type Shard struct { ID uint64 `json:"id,omitempty"` DataNodeIDs []uint64 `json:"nodeIDs,omitempty"` // owners // contains filtered or unexported fields }
Shard represents the logical storage for a given time range. The instance on a local server may contain the raw data in "store" if the shard is assigned to the server's data node id.
func (*Shard) HasDataNodeID ¶
HasDataNodeID return true if the data node owns the shard.
type ShardGroup ¶
type ShardGroup struct { ID uint64 `json:"id,omitempty"` StartTime time.Time `json:"startTime,omitempty"` EndTime time.Time `json:"endTime,omitempty"` Shards []*Shard `json:"shards,omitempty"` }
ShardGroup represents a group of shards created for a single time range.
func (*ShardGroup) Contains ¶
func (g *ShardGroup) Contains(min, max time.Time) bool
Contains return whether the shard group contains data for the time between min and max
func (*ShardGroup) Duration ¶
func (g *ShardGroup) Duration() time.Duration
Duration returns the duration between the shard group's start and end time.
func (*ShardGroup) ShardBySeriesID ¶
func (g *ShardGroup) ShardBySeriesID(seriesID uint32) *Shard
ShardBySeriesID returns the shard that a series is assigned to in the group.
type Snapshot ¶
type Snapshot struct {
Files []SnapshotFile `json:"files"`
}
Snapshot represents the state of the Server at a given time.
func ReadFileSnapshot ¶
ReadFileSnapshot returns a Snapshot for a given base snapshot path. This snapshot merges all incremental backup snapshots as well.
type SnapshotFile ¶
type SnapshotFile struct { Name string `json:"name"` // filename Size int64 `json:"size"` // file size Index uint64 `json:"index"` // highest index applied }
SnapshotFile represents a single file in a Snapshot.
type SnapshotFileWriter ¶
SnapshotFileWriter is the interface used for writing a file to a snapshot.
type SnapshotFiles ¶
type SnapshotFiles []SnapshotFile
SnapshotFiles represents a sortable list of snapshot files.
func (SnapshotFiles) Len ¶
func (p SnapshotFiles) Len() int
func (SnapshotFiles) Less ¶
func (p SnapshotFiles) Less(i, j int) bool
func (SnapshotFiles) Swap ¶
func (p SnapshotFiles) Swap(i, j int)
type SnapshotReader ¶
type SnapshotReader struct {
// contains filtered or unexported fields
}
SnapshotReader reads a snapshot from a Reader. This type is not safe for concurrent use.
func NewSnapshotReader ¶
func NewSnapshotReader(r io.Reader) *SnapshotReader
NewSnapshotReader returns a new SnapshotReader reading from r.
func (*SnapshotReader) Next ¶
func (sr *SnapshotReader) Next() (SnapshotFile, error)
Next returns the next file in the snapshot.
func (*SnapshotReader) Read ¶
func (sr *SnapshotReader) Read(b []byte) (n int, err error)
Read reads the current entry in the snapshot.
func (*SnapshotReader) Snapshot ¶
func (sr *SnapshotReader) Snapshot() (*Snapshot, error)
Snapshot returns the snapshot meta data.
type SnapshotWriter ¶
type SnapshotWriter struct { // The snapshot to write from. // Removing files from the snapshot after creation will cause those files to be ignored. Snapshot *Snapshot // Writers for each file by filename. // Writers will be closed as they're processed and will close by the end of WriteTo(). FileWriters map[string]SnapshotFileWriter }
SnapshotWriter writes a snapshot and the underlying files to disk as a tar archive.
func NewSnapshotWriter ¶
func NewSnapshotWriter() *SnapshotWriter
NewSnapshotWriter returns a new instance of SnapshotWriter.
func (*SnapshotWriter) Close ¶
func (sw *SnapshotWriter) Close() error
Close closes all file writers on the snapshot.
type SnapshotsReader ¶
type SnapshotsReader struct {
// contains filtered or unexported fields
}
SnapshotsReader reads from a collection of snapshots. Only files with the highest index are read from the reader. This type is not safe for concurrent use.
func NewSnapshotsReader ¶
func NewSnapshotsReader(readers ...io.Reader) *SnapshotsReader
NewSnapshotsReader returns a new SnapshotsReader reading from a list of readers.
func OpenFileSnapshotsReader ¶
func OpenFileSnapshotsReader(path string) (*SnapshotsReader, []io.Closer, error)
OpenFileSnapshotsReader returns a SnapshotsReader based on the path of the base snapshot. Returns the underlying files which need to be closed separately.
func (*SnapshotsReader) Next ¶
func (ssr *SnapshotsReader) Next() (SnapshotFile, error)
Next returns the next file in the reader.
func (*SnapshotsReader) Read ¶
func (ssr *SnapshotsReader) Read(b []byte) (n int, err error)
Read reads the current entry in the reader.
func (*SnapshotsReader) Snapshot ¶
func (ssr *SnapshotsReader) Snapshot() (*Snapshot, error)
Snapshot returns the combined snapshot from all readers.
type Stats ¶
type Stats struct {
// contains filtered or unexported fields
}
Stats represents a collection of metrics, as key-value pairs.
func (*Stats) Diff ¶
Diff returns the difference between two sets of stats. The result is undefined if the two Stats objects do not contain the same keys.
type SystemDiagnostics ¶
SystemDiagnostics captures basic machine data.
func NewSystemDiagnostics ¶
func NewSystemDiagnostics() *SystemDiagnostics
NewSystemDiagnostics returns a SystemDiagnostics object.
type User ¶
type User struct { Name string `json:"name"` Hash string `json:"hash"` Privileges map[string]influxql.Privilege `json:"privileges"` // db name to privilege Admin bool `json:"admin,omitempty"` }
User represents a user account on the system. It can be given read/write permissions to individual databases.
func (*User) Authenticate ¶
Authenticate returns nil if the password matches the user's password. Returns an error if the password was incorrect.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package influxql implements a parser for the InfluxDB query language.
|
Package influxql implements a parser for the InfluxDB query language. |
Package messaging implements a distributed, raft-backed messaging system.
|
Package messaging implements a distributed, raft-backed messaging system. |
Package raft implements a streaming version of the Raft protocol.
|
Package raft implements a streaming version of the Raft protocol. |
tests
|
|
The uuid package can be used to generate and parse universally unique identifiers, a standardized format in the form of a 128 bit number.
|
The uuid package can be used to generate and parse universally unique identifiers, a standardized format in the form of a 128 bit number. |