Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultHost(hostname, addr string) (string, error)
- func MarshalTime(t time.Time) int64
- func UnmarshalTime(v int64) time.Time
- type Client
- func (c *Client) AcquireLease(name string) (l *Lease, err error)
- func (c *Client) AdminUserExists() bool
- func (c *Client) Authenticate(username, password string) (*UserInfo, error)
- func (c *Client) Close() error
- func (c *Client) ClusterID() uint64
- func (c *Client) CreateContinuousQuery(database, name, query string) error
- func (c *Client) CreateDataNode(httpAddr, tcpAddr string) (*NodeInfo, error)
- func (c *Client) CreateDatabase(name string) (*DatabaseInfo, error)
- func (c *Client) CreateDatabaseWithRetentionPolicy(name string, rpi *RetentionPolicyInfo) (*DatabaseInfo, error)
- func (c *Client) CreateMetaNode(httpAddr, tcpAddr string) (*NodeInfo, error)
- func (c *Client) CreateRetentionPolicy(database string, rpi *RetentionPolicyInfo) (*RetentionPolicyInfo, error)
- func (c *Client) CreateShardGroup(database, policy string, timestamp time.Time) (*ShardGroupInfo, error)
- func (c *Client) CreateSubscription(database, rp, name, mode string, destinations []string) error
- func (c *Client) CreateUser(name, password string, admin bool) (*UserInfo, error)
- func (c *Client) DataNode(id uint64) (*NodeInfo, error)
- func (c *Client) DataNodeByHTTPHost(httpAddr string) (*NodeInfo, error)
- func (c *Client) DataNodes() ([]NodeInfo, error)
- func (c *Client) Database(name string) (*DatabaseInfo, error)
- func (c *Client) Databases() ([]DatabaseInfo, error)
- func (c *Client) DeleteDataNode(id uint64) error
- func (c *Client) DeleteMetaNode(id uint64) error
- func (c *Client) DeleteShardGroup(database, policy string, id uint64) error
- func (c *Client) DropContinuousQuery(database, name string) error
- func (c *Client) DropDatabase(name string) error
- func (c *Client) DropRetentionPolicy(database, name string) error
- func (c *Client) DropSubscription(database, rp, name string) error
- func (c *Client) DropUser(name string) error
- func (c *Client) ExecuteStatement(stmt influxql.Statement) *influxql.Result
- func (c *Client) IsLeader() bool
- func (c *Client) JoinMetaServer(httpAddr, tcpAddr string) error
- func (c *Client) MarshalBinary() ([]byte, error)
- func (c *Client) MetaNodeByAddr(addr string) *NodeInfo
- func (c *Client) MetaNodes() ([]NodeInfo, error)
- func (c *Client) NodeID() uint64
- func (c *Client) Open() error
- func (c *Client) Ping(checkAllMetaServers bool) error
- func (c *Client) PrecreateShardGroups(from, to time.Time) error
- func (c *Client) RetentionPolicy(database, name string) (rpi *RetentionPolicyInfo, err error)
- func (c *Client) SetAdminPrivilege(username string, admin bool) error
- func (c *Client) SetData(data *Data) error
- func (c *Client) SetDefaultRetentionPolicy(database, name string) error
- func (c *Client) SetLogger(l *log.Logger)
- func (c *Client) SetPrivilege(username, database string, p influxql.Privilege) error
- func (c *Client) ShardGroupsByTimeRange(database, policy string, min, max time.Time) (a []ShardGroupInfo, err error)
- func (c *Client) ShardIDs() []uint64
- func (c *Client) ShardIDsByTimeRange(sources influxql.Sources, tmin, tmax time.Time) (a []uint64, err error)
- func (c *Client) ShardOwner(shardID uint64) (database, policy string, sgi *ShardGroupInfo)
- func (c *Client) UpdateRetentionPolicy(database, name string, rpu *RetentionPolicyUpdate) error
- func (c *Client) UpdateUser(name, password string) error
- func (c *Client) User(name string) (*UserInfo, error)
- func (c *Client) UserCount() int
- func (c *Client) UserPrivilege(username, database string) (*influxql.Privilege, error)
- func (c *Client) UserPrivileges(username string) (map[string]influxql.Privilege, error)
- func (c *Client) Users() []UserInfo
- func (c *Client) WaitForDataChanged() chan struct{}
- type Config
- type ContinuousQueryInfo
- type Data
- func (data *Data) Clone() *Data
- func (data *Data) CloneDatabases() []DatabaseInfo
- func (data *Data) CreateContinuousQuery(database, name, query string) error
- func (data *Data) CreateDataNode(host, tcpHost string) error
- func (data *Data) CreateDatabase(name string) error
- func (data *Data) CreateMetaNode(httpAddr, tcpAddr string) error
- func (data *Data) CreateRetentionPolicy(database string, rpi *RetentionPolicyInfo) error
- func (data *Data) CreateShardGroup(database, policy string, timestamp time.Time) error
- func (data *Data) CreateSubscription(database, rp, name, mode string, destinations []string) error
- func (data *Data) CreateUser(name, hash string, admin bool) error
- func (data *Data) DataNode(id uint64) *NodeInfo
- func (data *Data) Database(name string) *DatabaseInfo
- func (data *Data) DeleteDataNode(id uint64) error
- func (data *Data) DeleteMetaNode(id uint64) error
- func (data *Data) DeleteShardGroup(database, policy string, id uint64) error
- func (data *Data) DropContinuousQuery(database, name string) error
- func (data *Data) DropDatabase(name string) error
- func (data *Data) DropRetentionPolicy(database, name string) error
- func (data *Data) DropSubscription(database, rp, name string) error
- func (data *Data) DropUser(name string) error
- func (data *Data) MarshalBinary() ([]byte, error)
- func (data *Data) MetaNode(id uint64) *NodeInfo
- func (data *Data) RetentionPolicy(database, name string) (*RetentionPolicyInfo, error)
- func (data *Data) SetAdminPrivilege(name string, admin bool) error
- func (data *Data) SetDefaultRetentionPolicy(database, name string) error
- func (data *Data) SetMetaNode(httpAddr, tcpAddr string) error
- func (data *Data) SetPrivilege(name, database string, p influxql.Privilege) error
- func (data *Data) ShardGroupByTimestamp(database, policy string, timestamp time.Time) (*ShardGroupInfo, error)
- func (data *Data) ShardGroups(database, policy string) ([]ShardGroupInfo, error)
- func (data *Data) ShardGroupsByTimeRange(database, policy string, tmin, tmax time.Time) ([]ShardGroupInfo, error)
- func (data *Data) UnmarshalBinary(buf []byte) error
- func (data *Data) UpdateRetentionPolicy(database, name string, rpu *RetentionPolicyUpdate) error
- func (data *Data) UpdateUser(name, hash string) error
- func (data *Data) User(username string) *UserInfo
- func (data *Data) UserPrivilege(name, database string) (*influxql.Privilege, error)
- func (data *Data) UserPrivileges(name string) (map[string]influxql.Privilege, error)
- type DatabaseInfo
- type Lease
- type Leases
- type NodeInfo
- type NodeInfos
- type Peers
- type RetentionPolicyInfo
- type RetentionPolicyUpdate
- type Service
- type ShardGroupInfo
- type ShardGroupInfos
- type ShardInfo
- type ShardOwner
- type StatementExecutor
- type SubscriptionInfo
- type UserInfo
Constants ¶
const ( // DefaultEnabled is the default state for the meta service to run DefaultEnabled = true // DefaultHostname is the default hostname if one is not provided. DefaultHostname = "localhost" // DefaultRaftBindAddress is the default address to bind to. DefaultRaftBindAddress = ":8088" // DefaultHTTPBindAddress is the default address to bind the API to. DefaultHTTPBindAddress = ":8091" // DefaultHeartbeatTimeout is the default heartbeat timeout for the store. DefaultHeartbeatTimeout = 1000 * time.Millisecond // DefaultElectionTimeout is the default election timeout for the store. DefaultElectionTimeout = 1000 * time.Millisecond // DefaultLeaderLeaseTimeout is the default leader lease for the store. DefaultLeaderLeaseTimeout = 500 * time.Millisecond // DefaultCommitTimeout is the default commit timeout for the store. DefaultCommitTimeout = 50 * time.Millisecond // DefaultRaftPromotionEnabled is the default for auto promoting a node to a raft node when needed DefaultRaftPromotionEnabled = true // DefaultLeaseDuration is the default duration for leases. DefaultLeaseDuration = 60 * time.Second // DefaultLoggingEnabled determines if log messages are printed for the meta service DefaultLoggingEnabled = true )
const ( // DefaultRetentionPolicyReplicaN is the default value of RetentionPolicyInfo.ReplicaN. DefaultRetentionPolicyReplicaN = 1 // DefaultRetentionPolicyDuration is the default value of RetentionPolicyInfo.Duration. DefaultRetentionPolicyDuration = 7 * (24 * time.Hour) // MinRetentionPolicyDuration represents the minimum duration for a policy. MinRetentionPolicyDuration = time.Hour )
const (
MuxHeader = 8
)
const (
// SaltBytes is the number of bytes used for salts
SaltBytes = 32
)
Variables ¶
var ( errors.New("meta service unavailable") // ErrService is returned when the meta service returns an error. ErrService = errors.New("meta service error") )ErrServiceUnavailable =
var ( // ErrStoreOpen is returned when opening an already open store. ErrStoreOpen = errors.New("store already open") // ErrStoreClosed is returned when closing an already closed store. ErrStoreClosed = errors.New("raft store already closed") // ErrTooManyPeers is returned when more than 3 peers are used. ErrTooManyPeers = errors.New("too many peers; influxdb v0.9.0 is limited to 3 nodes in a cluster") )
var ( // ErrNodeExists is returned when creating an already existing node. ErrNodeExists = errors.New("node already exists") // ErrNodeNotFound is returned when mutating a node that doesn't exist. ErrNodeNotFound = errors.New("node not found") // ErrNodesRequired is returned when at least one node is required for an operation. // This occurs when creating a shard group. ErrNodesRequired = errors.New("at least one node required") // ErrNodeIDRequired is returned when using a zero node id. ErrNodeIDRequired = errors.New("node id must be greater than 0") // ErrNodeUnableToDropFinalNode is returned if the node being dropped is the last // node in the cluster ErrNodeUnableToDropFinalNode = errors.New("unable to drop the final node in a cluster") )
var ( // ErrDatabaseExists is returned when creating an already existing database. ErrDatabaseExists = errors.New("database already exists") // ErrDatabaseNotExists is returned when operating on a not existing database. ErrDatabaseNotExists = errors.New("database does not exist") // ErrDatabaseNameRequired is returned when creating a database without a name. ErrDatabaseNameRequired = errors.New("database name required") )
var ( // ErrRetentionPolicyExists is returned when creating an already existing policy. ErrRetentionPolicyExists = errors.New("retention policy already exists") // ErrRetentionPolicyDefault is returned when attempting a prohibited operation // on a default retention policy. ErrRetentionPolicyDefault = errors.New("retention policy is default") // ErrRetentionPolicyNameRequired is returned when creating a policy without a name. ErrRetentionPolicyNameRequired = errors.New("retention policy name required") // ErrRetentionPolicyNameExists is returned when renaming a policy to // the same name as another existing policy. ErrRetentionPolicyNameExists = errors.New("retention policy name already exists") // ErrRetentionPolicyDurationTooLow is returned when updating a retention // policy that has a duration lower than the allowed minimum. ErrRetentionPolicyDurationTooLow = errors.New(fmt.Sprintf("retention policy duration must be at least %s", MinRetentionPolicyDuration)) // ErrReplicationFactorTooLow is returned when the replication factor is not in an // acceptable range. ErrReplicationFactorTooLow = errors.New("replication factor must be greater than 0") )
var ( // ErrShardGroupExists is returned when creating an already existing shard group. ErrShardGroupExists = errors.New("shard group already exists") // ErrShardGroupNotFound is returned when mutating a shard group that doesn't exist. ErrShardGroupNotFound = errors.New("shard group not found") // ErrShardNotReplicated is returned if the node requested to be dropped has // the last copy of a shard present and the force keyword was not used ErrShardNotReplicated = errors.New("shard not replicated") )
var ( // ErrContinuousQueryExists is returned when creating an already existing continuous query. ErrContinuousQueryExists = errors.New("continuous query already exists") // ErrContinuousQueryNotFound is returned when removing a continuous query that doesn't exist. ErrContinuousQueryNotFound = errors.New("continuous query not found") )
var ( // ErrSubscriptionExists is returned when creating an already existing subscription. ErrSubscriptionExists = errors.New("subscription already exists") // ErrSubscriptionNotFound is returned when removing a subscription that doesn't exist. ErrSubscriptionNotFound = errors.New("subscription not found") )
var ( // ErrUserExists is returned when creating an already existing user. ErrUserExists = errors.New("user already exists") // ErrUserNotFound is returned when mutating a user that doesn't exist. ErrUserNotFound = errors.New("user not found") // ErrUsernameRequired is returned when creating a user without a username. ErrUsernameRequired = errors.New("username required") // ErrAuthenticate is returned when authentication fails. ErrAuthenticate = errors.New("authentication failed") )
Functions ¶
func DefaultHost ¶
func MarshalTime ¶
MarshalTime converts t to nanoseconds since epoch. A zero time returns 0.
func UnmarshalTime ¶
UnmarshalTime converts nanoseconds since epoch to time. A zero value returns a zero time.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used to execute commands on and read data from a meta service cluster.
func (*Client) AcquireLease ¶
AcquireLease attempts to acquire the specified lease. A lease is a logical concept that can be used by anything that needs to limit execution to a single node. E.g., the CQ service on all nodes may ask for the "ContinuousQuery" lease. Only the node that acquires it will run CQs. NOTE: Leases are not managed through the CP system and are not fully consistent. Any actions taken after acquiring a lease must be idempotent.
func (*Client) AdminUserExists ¶
func (*Client) Authenticate ¶
func (*Client) CreateContinuousQuery ¶
func (*Client) CreateDataNode ¶
CreateDataNode will create a new data node in the metastore
func (*Client) CreateDatabase ¶
func (c *Client) CreateDatabase(name string) (*DatabaseInfo, error)
CreateDatabase creates a database or returns it if it already exists
func (*Client) CreateDatabaseWithRetentionPolicy ¶
func (c *Client) CreateDatabaseWithRetentionPolicy(name string, rpi *RetentionPolicyInfo) (*DatabaseInfo, error)
CreateDatabaseWithRetentionPolicy creates a database with the specified retention policy.
func (*Client) CreateMetaNode ¶
func (*Client) CreateRetentionPolicy ¶
func (c *Client) CreateRetentionPolicy(database string, rpi *RetentionPolicyInfo) (*RetentionPolicyInfo, error)
CreateRetentionPolicy creates a retention policy on the specified database.
func (*Client) CreateShardGroup ¶
func (c *Client) CreateShardGroup(database, policy string, timestamp time.Time) (*ShardGroupInfo, error)
CreateShardGroup creates a shard group on a database and policy for a given timestamp.
func (*Client) CreateSubscription ¶
func (*Client) CreateUser ¶
func (*Client) DataNodeByHTTPHost ¶
DataNodeByHTTPHost returns the data node with the give http bind address
func (*Client) Database ¶
func (c *Client) Database(name string) (*DatabaseInfo, error)
Database returns info for the requested database.
func (*Client) Databases ¶
func (c *Client) Databases() ([]DatabaseInfo, error)
Databases returns a list of all database infos.
func (*Client) DeleteDataNode ¶
DeleteDataNode deletes a data node from the cluster.
func (*Client) DeleteMetaNode ¶
func (*Client) DeleteShardGroup ¶
DeleteShardGroup removes a shard group from a database and retention policy by id.
func (*Client) DropContinuousQuery ¶
func (*Client) DropDatabase ¶
DropDatabase deletes a database.
func (*Client) DropRetentionPolicy ¶
DropRetentionPolicy drops a retention policy from a database.
func (*Client) DropSubscription ¶
func (*Client) ExecuteStatement ¶
func (*Client) JoinMetaServer ¶
JoinMetaServer will add the passed in tcpAddr to the raft peers and add a MetaNode to the metastore
func (*Client) MarshalBinary ¶
func (*Client) MetaNodeByAddr ¶
MetaNodeByAddr returns the meta node's info.
func (*Client) Ping ¶
Ping will hit the ping endpoint for the metaservice and return nil if it returns 200. If checkAllMetaServers is set to true, it will hit the ping endpoint and tell it to verify the health of all metaservers in the cluster
func (*Client) PrecreateShardGroups ¶
PrecreateShardGroups creates shard groups whose endtime is before the 'to' time passed in, but is yet to expire before 'from'. This is to avoid the need for these shards to be created when data for the corresponding time range arrives. Shard creation involves Raft consensus, and precreation avoids taking the hit at write-time.
func (*Client) RetentionPolicy ¶
func (c *Client) RetentionPolicy(database, name string) (rpi *RetentionPolicyInfo, err error)
RetentionPolicy returns the requested retention policy info.
func (*Client) SetAdminPrivilege ¶
func (*Client) SetDefaultRetentionPolicy ¶
SetDefaultRetentionPolicy sets a database's default retention policy.
func (*Client) SetPrivilege ¶
func (*Client) ShardGroupsByTimeRange ¶
func (c *Client) ShardGroupsByTimeRange(database, policy string, min, max time.Time) (a []ShardGroupInfo, err error)
ShardGroupsByTimeRange returns a list of all shard groups on a database and policy that may contain data for the specified time range. Shard groups are sorted by start time.
func (*Client) ShardIDsByTimeRange ¶
func (c *Client) ShardIDsByTimeRange(sources influxql.Sources, tmin, tmax time.Time) (a []uint64, err error)
ShardIDsByTimeRange returns a slice of shards that may contain data in the time range.
func (*Client) ShardOwner ¶
func (c *Client) ShardOwner(shardID uint64) (database, policy string, sgi *ShardGroupInfo)
ShardOwner returns the owning shard group info for a specific shard.
func (*Client) UpdateRetentionPolicy ¶
func (c *Client) UpdateRetentionPolicy(database, name string, rpu *RetentionPolicyUpdate) error
UpdateRetentionPolicy updates a retention policy.
func (*Client) UpdateUser ¶
func (*Client) UserPrivilege ¶
func (*Client) UserPrivileges ¶
func (*Client) WaitForDataChanged ¶
func (c *Client) WaitForDataChanged() chan struct{}
WaitForDataChanged will return a channel that will get closed when the metastore data has changed
type Config ¶
type Config struct { Enabled bool `toml:"enabled"` Dir string `toml:"dir"` // this is deprecated. Should use the address from run/config.go BindAddress string `toml:"bind-address"` // HTTPBindAddress is the bind address for the metaservice HTTP API HTTPBindAddress string `toml:"http-bind-address"` HTTPSEnabled bool `toml:"https-enabled"` HTTPSCertificate string `toml:"https-certificate"` // JoinPeers if specified gives other metastore servers to join this server to the cluster JoinPeers []string `toml:"-"` RetentionAutoCreate bool `toml:"retention-autocreate"` ElectionTimeout toml.Duration `toml:"election-timeout"` HeartbeatTimeout toml.Duration `toml:"heartbeat-timeout"` LeaderLeaseTimeout toml.Duration `toml:"leader-lease-timeout"` CommitTimeout toml.Duration `toml:"commit-timeout"` ClusterTracing bool `toml:"cluster-tracing"` RaftPromotionEnabled bool `toml:"raft-promotion-enabled"` LoggingEnabled bool `toml:"logging-enabled"` PprofEnabled bool `toml:"pprof-enabled"` LeaseDuration toml.Duration `toml:"lease-duration"` }
Config represents the meta configuration.
func (*Config) DefaultedBindAddress ¶
DefaultedBindAddress returns the BindAddress normalized with the hosts name or "localhost" if that could not be determined. If the BindAddress already has a hostname, BindAddress is returned.
func (*Config) DefaultedHTTPBindAddress ¶
DefaultedHTTPBindAddress returns the HTTPBindAddress normalized with the hosts name or "localhost" if that could not be determined. If the HTTPBindAddress already has a hostname, HTTPBindAddress is returned.
type ContinuousQueryInfo ¶
ContinuousQueryInfo represents metadata about a continuous query.
type Data ¶
type Data struct { Term uint64 // associated raft term Index uint64 // associated raft index ClusterID uint64 MetaNodes []NodeInfo DataNodes []NodeInfo Databases []DatabaseInfo Users []UserInfo MaxNodeID uint64 MaxShardGroupID uint64 MaxShardID uint64 }
Data represents the top level collection of all metadata.
func (*Data) CloneDatabases ¶
func (data *Data) CloneDatabases() []DatabaseInfo
CloneDatabases returns a copy of the databases.
func (*Data) CreateContinuousQuery ¶
CreateContinuousQuery adds a named continuous query to a database.
func (*Data) CreateDataNode ¶
CreateDataNode adds a node to the metadata.
func (*Data) CreateDatabase ¶
CreateDatabase creates a new database. Returns an error if name is blank or if a database with the same name already exists.
func (*Data) CreateMetaNode ¶
CreateMetaNode will add a new meta node to the metastore
func (*Data) CreateRetentionPolicy ¶
func (data *Data) CreateRetentionPolicy(database string, rpi *RetentionPolicyInfo) error
CreateRetentionPolicy creates a new retention policy on a database. Returns an error if name is blank or if a database does not exist.
func (*Data) CreateShardGroup ¶
CreateShardGroup creates a shard group on a database and policy for a given timestamp.
func (*Data) CreateSubscription ¶
CreateSubscription adds a named subscription to a database and retention policy.
func (*Data) CreateUser ¶
CreateUser creates a new user.
func (*Data) Database ¶
func (data *Data) Database(name string) *DatabaseInfo
Database returns a database by name.
func (*Data) DeleteDataNode ¶
DeleteDataNode removes a node from the metadata.
func (*Data) DeleteMetaNode ¶
DeleteMetaNode will remove the meta node from the store
func (*Data) DeleteShardGroup ¶
DeleteShardGroup removes a shard group from a database and retention policy by id.
func (*Data) DropContinuousQuery ¶
DropContinuousQuery removes a continuous query.
func (*Data) DropDatabase ¶
DropDatabase removes a database by name.
func (*Data) DropRetentionPolicy ¶
DropRetentionPolicy removes a retention policy from a database by name.
func (*Data) DropSubscription ¶
DropSubscription removes a subscription.
func (*Data) MarshalBinary ¶
MarshalBinary encodes the metadata to a binary format.
func (*Data) RetentionPolicy ¶
func (data *Data) RetentionPolicy(database, name string) (*RetentionPolicyInfo, error)
RetentionPolicy returns a retention policy for a database by name.
func (*Data) SetAdminPrivilege ¶
SetAdminPrivilege sets the admin privilege for a user.
func (*Data) SetDefaultRetentionPolicy ¶
SetDefaultRetentionPolicy sets the default retention policy for a database.
func (*Data) SetMetaNode ¶
SetMetaNode will update the information for the single meta node or create a new metanode. If there are more than 1 meta nodes already, an error will be returned
func (*Data) SetPrivilege ¶
SetPrivilege sets a privilege for a user on a database.
func (*Data) ShardGroupByTimestamp ¶
func (data *Data) ShardGroupByTimestamp(database, policy string, timestamp time.Time) (*ShardGroupInfo, error)
ShardGroupByTimestamp returns the shard group on a database and policy for a given timestamp.
func (*Data) ShardGroups ¶
func (data *Data) ShardGroups(database, policy string) ([]ShardGroupInfo, error)
ShardGroups returns a list of all shard groups on a database and policy.
func (*Data) ShardGroupsByTimeRange ¶
func (data *Data) ShardGroupsByTimeRange(database, policy string, tmin, tmax time.Time) ([]ShardGroupInfo, error)
ShardGroupsByTimeRange returns a list of all shard groups on a database and policy that may contain data for the specified time range. Shard groups are sorted by start time.
func (*Data) UnmarshalBinary ¶
UnmarshalBinary decodes the object from a binary format.
func (*Data) UpdateRetentionPolicy ¶
func (data *Data) UpdateRetentionPolicy(database, name string, rpu *RetentionPolicyUpdate) error
UpdateRetentionPolicy updates an existing retention policy.
func (*Data) UpdateUser ¶
UpdateUser updates the password hash of an existing user.
func (*Data) UserPrivilege ¶
UserPrivilege gets the privilege for a user on a database.
type DatabaseInfo ¶
type DatabaseInfo struct { Name string DefaultRetentionPolicy string RetentionPolicies []RetentionPolicyInfo ContinuousQueries []ContinuousQueryInfo }
DatabaseInfo represents information about a database in the system.
func (DatabaseInfo) RetentionPolicy ¶
func (di DatabaseInfo) RetentionPolicy(name string) *RetentionPolicyInfo
RetentionPolicy returns a retention policy by name.
func (DatabaseInfo) ShardInfos ¶
func (di DatabaseInfo) ShardInfos() []ShardInfo
ShardInfos returns a list of all shards' info for the database.
type RetentionPolicyInfo ¶
type RetentionPolicyInfo struct { Name string ReplicaN int Duration time.Duration ShardGroupDuration time.Duration ShardGroups []ShardGroupInfo Subscriptions []SubscriptionInfo }
RetentionPolicyInfo represents metadata about a retention policy.
func NewRetentionPolicyInfo ¶
func NewRetentionPolicyInfo(name string) *RetentionPolicyInfo
NewRetentionPolicyInfo returns a new instance of RetentionPolicyInfo with defaults set.
func (*RetentionPolicyInfo) DeletedShardGroups ¶
func (rpi *RetentionPolicyInfo) DeletedShardGroups() []*ShardGroupInfo
DeletedShardGroups returns the Shard Groups which are marked as deleted.
func (*RetentionPolicyInfo) ExpiredShardGroups ¶
func (rpi *RetentionPolicyInfo) ExpiredShardGroups(t time.Time) []*ShardGroupInfo
ExpiredShardGroups returns the Shard Groups which are considered expired, for the given time.
func (*RetentionPolicyInfo) ShardGroupByTimestamp ¶
func (rpi *RetentionPolicyInfo) ShardGroupByTimestamp(timestamp time.Time) *ShardGroupInfo
ShardGroupByTimestamp returns the shard group in the policy that contains the timestamp.
type RetentionPolicyUpdate ¶
RetentionPolicyUpdate represents retention policy fields to be updated.
func (*RetentionPolicyUpdate) SetDuration ¶
func (rpu *RetentionPolicyUpdate) SetDuration(v time.Duration)
SetDuration sets the RetentionPolicyUpdate.Duration
func (*RetentionPolicyUpdate) SetName ¶
func (rpu *RetentionPolicyUpdate) SetName(v string)
SetName sets the RetentionPolicyUpdate.Name
func (*RetentionPolicyUpdate) SetReplicaN ¶
func (rpu *RetentionPolicyUpdate) SetReplicaN(v int)
SetReplicaN sets the RetentionPolicyUpdate.ReplicaN
type Service ¶
type Service struct { RaftListener net.Listener Logger *log.Logger // contains filtered or unexported fields }
type ShardGroupInfo ¶
type ShardGroupInfo struct { ID uint64 StartTime time.Time EndTime time.Time DeletedAt time.Time Shards []ShardInfo }
ShardGroupInfo represents metadata about a shard group. The DeletedAt field is important because it makes it clear that a ShardGroup has been marked as deleted, and allow the system to be sure that a ShardGroup is not simply missing. If the DeletedAt is set, the system can safely delete any associated shards.
func (*ShardGroupInfo) Contains ¶
func (sgi *ShardGroupInfo) Contains(timestamp time.Time) bool
Contains return true if the shard group contains data for the timestamp.
func (*ShardGroupInfo) Deleted ¶
func (sgi *ShardGroupInfo) Deleted() bool
Deleted returns whether this ShardGroup has been deleted.
func (*ShardGroupInfo) Overlaps ¶
func (sgi *ShardGroupInfo) Overlaps(min, max time.Time) bool
Overlaps return whether the shard group contains data for the time range between min and max
func (*ShardGroupInfo) ShardFor ¶
func (sgi *ShardGroupInfo) ShardFor(hash uint64) ShardInfo
ShardFor returns the ShardInfo for a Point hash
type ShardGroupInfos ¶
type ShardGroupInfos []ShardGroupInfo
ShardGroupInfos is a collection of ShardGroupInfo
func (ShardGroupInfos) Len ¶
func (a ShardGroupInfos) Len() int
func (ShardGroupInfos) Less ¶
func (a ShardGroupInfos) Less(i, j int) bool
func (ShardGroupInfos) Swap ¶
func (a ShardGroupInfos) Swap(i, j int)
type ShardInfo ¶
type ShardInfo struct { ID uint64 Owners []ShardOwner }
ShardInfo represents metadata about a shard.
func (*ShardInfo) UnmarshalBinary ¶
UnmarshalBinary decodes the object from a binary format.
type ShardOwner ¶
type ShardOwner struct {
NodeID uint64
}
ShardOwner represents a node that owns a shard.
type StatementExecutor ¶
type StatementExecutor struct { Store interface { DataNode(id uint64) (ni *NodeInfo, err error) DataNodes() ([]NodeInfo, error) MetaNodes() ([]NodeInfo, error) DeleteDataNode(nodeID uint64) error DeleteMetaNode(nodeID uint64) error Database(name string) (*DatabaseInfo, error) Databases() ([]DatabaseInfo, error) CreateDatabase(name string) (*DatabaseInfo, error) CreateDatabaseWithRetentionPolicy(name string, rpi *RetentionPolicyInfo) (*DatabaseInfo, error) DropDatabase(name string) error CreateRetentionPolicy(database string, rpi *RetentionPolicyInfo) (*RetentionPolicyInfo, error) UpdateRetentionPolicy(database, name string, rpu *RetentionPolicyUpdate) error SetDefaultRetentionPolicy(database, name string) error DropRetentionPolicy(database, name string) error Users() []UserInfo CreateUser(name, password string, admin bool) (*UserInfo, error) UpdateUser(name, password string) error DropUser(name string) error SetPrivilege(username, database string, p influxql.Privilege) error SetAdminPrivilege(username string, admin bool) error UserPrivileges(username string) (map[string]influxql.Privilege, error) UserPrivilege(username, database string) (*influxql.Privilege, error) CreateContinuousQuery(database, name, query string) error DropContinuousQuery(database, name string) error CreateSubscription(database, rp, name, mode string, destinations []string) error DropSubscription(database, rp, name string) error } }
StatementExecutor translates InfluxQL queries to meta store methods.
func (*StatementExecutor) ExecuteStatement ¶
func (e *StatementExecutor) ExecuteStatement(stmt influxql.Statement) *influxql.Result
ExecuteStatement executes stmt against the meta store as user.
type SubscriptionInfo ¶
SubscriptionInfo hold the subscription information