Documentation ¶
Index ¶
- Constants
- Variables
- func MarshalTime(t time.Time) int64
- func UnmarshalTime(v int64) time.Time
- type Config
- type ContinuousQueryInfo
- type Data
- func (data *Data) Clone() *Data
- func (data *Data) CreateContinuousQuery(database, name, query string) error
- func (data *Data) CreateDatabase(name string) error
- func (data *Data) CreateNode(host 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) CreateUser(name, hash string, admin bool) error
- func (data *Data) Database(name string) *DatabaseInfo
- func (data *Data) DeleteNode(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) DropUser(name string) error
- func (data *Data) MarshalBinary() ([]byte, error)
- func (data *Data) Node(id uint64) *NodeInfo
- func (data *Data) NodeByHost(host string) *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) 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 HashPasswordFn
- type JoinResult
- type NodeInfo
- type Reply
- type RetentionPolicyInfo
- type RetentionPolicyUpdate
- type ShardGroupInfo
- type ShardGroupInfos
- type ShardInfo
- type StatementExecutor
- type Store
- func (s *Store) AddPeer(addr string) error
- func (s *Store) AdminUserExists() (exists bool, err error)
- func (s *Store) Authenticate(username, password string) (ui *UserInfo, err error)
- func (s *Store) Close() error
- func (s *Store) ClusterID() (id uint64, err error)
- func (s *Store) CreateContinuousQuery(database, name, query string) error
- func (s *Store) CreateDatabase(name string) (*DatabaseInfo, error)
- func (s *Store) CreateDatabaseIfNotExists(name string) (*DatabaseInfo, error)
- func (s *Store) CreateNode(host string) (*NodeInfo, error)
- func (s *Store) CreateRetentionPolicy(database string, rpi *RetentionPolicyInfo) (*RetentionPolicyInfo, error)
- func (s *Store) CreateRetentionPolicyIfNotExists(database string, rpi *RetentionPolicyInfo) (*RetentionPolicyInfo, error)
- func (s *Store) CreateShardGroup(database, policy string, timestamp time.Time) (*ShardGroupInfo, error)
- func (s *Store) CreateShardGroupIfNotExists(database, policy string, timestamp time.Time) (*ShardGroupInfo, error)
- func (s *Store) CreateUser(name, password string, admin bool) (*UserInfo, error)
- func (s *Store) Database(name string) (di *DatabaseInfo, err error)
- func (s *Store) Databases() (dis []DatabaseInfo, err error)
- func (s *Store) DefaultRetentionPolicy(database string) (rpi *RetentionPolicyInfo, err error)
- func (s *Store) DeleteNode(id uint64) error
- func (s *Store) DeleteShardGroup(database, policy string, id uint64) error
- func (s *Store) DropContinuousQuery(database, name string) error
- func (s *Store) DropDatabase(name string) error
- func (s *Store) DropRetentionPolicy(database, name string) error
- func (s *Store) DropUser(name string) error
- func (s *Store) Err() <-chan error
- func (s *Store) GetHashPasswordFn() HashPasswordFn
- func (s *Store) IDPath() string
- func (s *Store) IsLeader() bool
- func (s *Store) Leader() string
- func (s *Store) MarshalBinary() ([]byte, error)
- func (s *Store) Node(id uint64) (ni *NodeInfo, err error)
- func (s *Store) NodeByHost(host string) (ni *NodeInfo, err error)
- func (s *Store) NodeID() uint64
- func (s *Store) Nodes() (a []NodeInfo, err error)
- func (s *Store) Open() error
- func (s *Store) Path() string
- func (s *Store) Peers() []string
- func (s *Store) PrecreateShardGroups(cutoff time.Time) error
- func (s *Store) Ready() <-chan struct{}
- func (s *Store) RetentionPolicies(database string) (a []RetentionPolicyInfo, err error)
- func (s *Store) RetentionPolicy(database, name string) (rpi *RetentionPolicyInfo, err error)
- func (s *Store) SetAdminPrivilege(username string, admin bool) error
- func (s *Store) SetData(data *Data) error
- func (s *Store) SetDefaultRetentionPolicy(database, name string) error
- func (s *Store) SetHashPasswordFn(fn HashPasswordFn)
- func (s *Store) SetPeers(addrs []string) error
- func (s *Store) SetPrivilege(username, database string, p influxql.Privilege) error
- func (s *Store) ShardGroupByTimestamp(database, policy string, timestamp time.Time) (sgi *ShardGroupInfo, err error)
- func (s *Store) ShardGroups(database, policy string) (a []ShardGroupInfo, err error)
- func (s *Store) ShardGroupsByTimeRange(database, policy string, tmin, tmax time.Time) (a []ShardGroupInfo, err error)
- func (s *Store) ShardOwner(shardID uint64) (database, policy string, sgi *ShardGroupInfo)
- func (s *Store) Snapshot() error
- func (s *Store) UpdateRetentionPolicy(database, name string, rpu *RetentionPolicyUpdate) error
- func (s *Store) UpdateUser(name, password string) error
- func (s *Store) User(name string) (ui *UserInfo, err error)
- func (s *Store) UserCount() (count int, err error)
- func (s *Store) UserPrivilege(username, database string) (p *influxql.Privilege, err error)
- func (s *Store) UserPrivileges(username string) (p map[string]influxql.Privilege, err error)
- func (s *Store) Users() (a []UserInfo, err error)
- func (s *Store) VisitRetentionPolicies(f func(d DatabaseInfo, r RetentionPolicyInfo))
- func (s *Store) WaitForDataChanged() error
- func (s *Store) WaitForLeader(timeout time.Duration) error
- type UserInfo
Constants ¶
const ( // DefaultHostname is the default hostname if one is not provided. DefaultHostname = "localhost" // DefaultBindAddress is the default address to bind to. DefaultBindAddress = ":8088" // 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 )
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 ( MuxRaftHeader = 0 MuxExecHeader = 1 MuxRPCHeader = 5 // SaltBytes is the number of bytes used for salts SaltBytes = 32 )
tcp.Mux header bytes.
const ( AutoCreateRetentionPolicyName = "default" AutoCreateRetentionPolicyPeriod = 0 RetentionPolicyMinDuration = time.Hour )
Retention policy settings.
const ExecMagic = "EXEC"
ExecMagic is the first 4 bytes sent to a remote exec connection to verify that it is coming from a remote exec client connection.
const (
MaxMessageSize = 1024 * 1024 * 1024
)
Max size of a message before we treat the size as invalid
const (
MaxRaftNodes = 3
)
Raft configuration.
Variables ¶
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") )
var ( // ErrDatabaseExists is returned when creating an already existing database. ErrDatabaseExists = errors.New("database already exists") // ErrDatabaseNotFound is returned when mutating a database that doesn't exist. ErrDatabaseNotFound = errors.New("database not found") // 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") // ErrRetentionPolicyNotFound is returned when mutating a policy that doesn't exist. ErrRetentionPolicyNotFound = errors.New("retention policy not found") // 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", RetentionPolicyMinDuration)) // ErrReplicationFactorMismatch is returned when the replication factor // does not match the number of nodes in the cluster. This is a temporary // restriction until v0.9.1 is released. ErrReplicationFactorMismatch = errors.New("replication factor must match cluster size; this limitation will be lifted in v0.9.1") )
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") )
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 ( // 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") )
var BcryptCost = 10
BcryptCost is the cost associated with generating password with Bcrypt. This setting is lowered during testing to improve test suite performance.
var ErrAuthenticate = errors.New("authentication failed")
ErrAuthenticate is returned when authentication fails.
Functions ¶
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 Config ¶
type Config struct { Dir string `toml:"dir"` Hostname string `toml:"hostname"` BindAddress string `toml:"bind-address"` Peers []string `toml:"peers"` 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"` // The join command-line argument Join string `toml:"-"` }
Config represents the meta configuration.
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 Nodes []NodeInfo Databases []DatabaseInfo Users []UserInfo MaxNodeID uint64 MaxShardGroupID uint64 MaxShardID uint64 }
Data represents the top level collection of all metadata.
func (*Data) CreateContinuousQuery ¶
CreateContinuousQuery adds a named continuous query to a database.
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) CreateNode ¶
CreateNode adds a node to the metadata.
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) CreateUser ¶
CreateUser creates a new user.
func (*Data) Database ¶
func (data *Data) Database(name string) *DatabaseInfo
Database returns a database by name.
func (*Data) DeleteNode ¶
DeleteNode removes a node from the metadata.
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) MarshalBinary ¶
MarshalBinary encodes the metadata to a binary format.
func (*Data) NodeByHost ¶
NodeByHost returns a node by hostname.
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) 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)
ShardGroup 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.
type HashPasswordFn ¶
HashPasswordFn represnets a password hashing function.
type JoinResult ¶
type Reply ¶
type Reply interface {
GetHeader() *internal.ResponseHeader
}
type RetentionPolicyInfo ¶
type RetentionPolicyInfo struct { Name string ReplicaN int Duration time.Duration ShardGroupDuration time.Duration ShardGroups []ShardGroupInfo }
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)
func (*RetentionPolicyUpdate) SetName ¶
func (rpu *RetentionPolicyUpdate) SetName(v string)
func (*RetentionPolicyUpdate) SetReplicaN ¶
func (rpu *RetentionPolicyUpdate) SetReplicaN(v int)
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 (s *ShardGroupInfo) ShardFor(hash uint64) ShardInfo
ShardFor returns the ShardInfo for a Point hash
type ShardGroupInfos ¶
type ShardGroupInfos []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 StatementExecutor ¶
type StatementExecutor struct { Store interface { Nodes() ([]NodeInfo, error) Database(name string) (*DatabaseInfo, error) Databases() ([]DatabaseInfo, error) CreateDatabase(name string) (*DatabaseInfo, error) DropDatabase(name string) error DefaultRetentionPolicy(database string) (*RetentionPolicyInfo, 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, error) 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 } }
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 Store ¶
type Store struct { // The listeners to accept raft and remote exec connections from. RaftListener net.Listener ExecListener net.Listener // The listener for higher-level, cluster operations RPCListener net.Listener // The advertised hostname of the store. Addr net.Addr // The amount of time before a follower starts a new election. HeartbeatTimeout time.Duration // The amount of time before a candidate starts a new election. ElectionTimeout time.Duration // The amount of time without communication to the cluster before a // leader steps down to a follower state. LeaderLeaseTimeout time.Duration // The amount of time without an apply before sending a heartbeat. CommitTimeout time.Duration Logger *log.Logger // contains filtered or unexported fields }
Store represents a raft-backed metastore.
func (*Store) AdminUserExists ¶
AdminUserExists returns true if an admin user exists on the system.
func (*Store) Authenticate ¶
Authenticate retrieves a user with a matching username and password.
func (*Store) ClusterID ¶
ClusterID returns the unique identifier for the cluster. This is generated once a node has been created.
func (*Store) CreateContinuousQuery ¶
CreateContinuousQuery creates a new continuous query on the store.
func (*Store) CreateDatabase ¶
func (s *Store) CreateDatabase(name string) (*DatabaseInfo, error)
CreateDatabase creates a new database in the store.
func (*Store) CreateDatabaseIfNotExists ¶
func (s *Store) CreateDatabaseIfNotExists(name string) (*DatabaseInfo, error)
CreateDatabaseIfNotExists creates a new database in the store if it doesn't already exist.
func (*Store) CreateNode ¶
CreateNode creates a new node in the store.
func (*Store) CreateRetentionPolicy ¶
func (s *Store) CreateRetentionPolicy(database string, rpi *RetentionPolicyInfo) (*RetentionPolicyInfo, error)
CreateRetentionPolicy creates a new retention policy for a database.
func (*Store) CreateRetentionPolicyIfNotExists ¶
func (s *Store) CreateRetentionPolicyIfNotExists(database string, rpi *RetentionPolicyInfo) (*RetentionPolicyInfo, error)
CreateRetentionPolicyIfNotExists creates a new policy in the store if it doesn't already exist.
func (*Store) CreateShardGroup ¶
func (s *Store) CreateShardGroup(database, policy string, timestamp time.Time) (*ShardGroupInfo, error)
CreateShardGroup creates a new shard group in a retention policy for a given time.
func (*Store) CreateShardGroupIfNotExists ¶
func (s *Store) CreateShardGroupIfNotExists(database, policy string, timestamp time.Time) (*ShardGroupInfo, error)
CreateShardGroupIfNotExists creates a new shard group if one doesn't already exist.
func (*Store) CreateUser ¶
CreateUser creates a new user in the store.
func (*Store) Database ¶
func (s *Store) Database(name string) (di *DatabaseInfo, err error)
Database returns a database by name.
func (*Store) Databases ¶
func (s *Store) Databases() (dis []DatabaseInfo, err error)
Databases returns a list of all databases.
func (*Store) DefaultRetentionPolicy ¶
func (s *Store) DefaultRetentionPolicy(database string) (rpi *RetentionPolicyInfo, err error)
DefaultRetentionPolicy returns the default retention policy for a database.
func (*Store) DeleteNode ¶
DeleteNode removes a node from the metastore by id.
func (*Store) DeleteShardGroup ¶
DeleteShardGroup removes an existing shard group from a policy by ID.
func (*Store) DropContinuousQuery ¶
DropContinuousQuery removes a continuous query from the store.
func (*Store) DropDatabase ¶
DropDatabase removes a database from the metastore by name.
func (*Store) DropRetentionPolicy ¶
DropRetentionPolicy removes a policy from a database by name.
func (*Store) GetHashPasswordFn ¶
func (s *Store) GetHashPasswordFn() HashPasswordFn
GetHashPasswordFn returns the current password hashing function.
func (*Store) Leader ¶
Leader returns what the store thinks is the current leader. An empty string indicates no leader exists.
func (*Store) MarshalBinary ¶
MarshalBinary encodes the store's data to a binary protobuf format.
func (*Store) NodeByHost ¶
NodeByHost returns a node by hostname.
func (*Store) NodeID ¶
NodeID returns the identifier for the local node. Panics if the node has not joined the cluster.
func (*Store) Path ¶
Path returns the root path when open. Returns an empty string when the store is closed.
func (*Store) PrecreateShardGroups ¶
PrecreateShardGroups creates shard groups whose endtime is before the cutoff time passed in. This 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 (*Store) Ready ¶
func (s *Store) Ready() <-chan struct{}
Ready returns a channel that is closed once the store is initialized.
func (*Store) RetentionPolicies ¶
func (s *Store) RetentionPolicies(database string) (a []RetentionPolicyInfo, err error)
RetentionPolicies returns a list of all retention policies for a database.
func (*Store) RetentionPolicy ¶
func (s *Store) RetentionPolicy(database, name string) (rpi *RetentionPolicyInfo, err error)
RetentionPolicy returns a retention policy for a database by name.
func (*Store) SetAdminPrivilege ¶
SetAdminPrivilege sets the admin privilege for a user on a database.
func (*Store) SetData ¶
SetData force overwrites the root data. This should only be used when restoring a snapshot.
func (*Store) SetDefaultRetentionPolicy ¶
SetDefaultRetentionPolicy sets the default retention policy for a database.
func (*Store) SetHashPasswordFn ¶
func (s *Store) SetHashPasswordFn(fn HashPasswordFn)
SetHashPasswordFn sets the password hashing function.
func (*Store) SetPrivilege ¶
SetPrivilege sets a privilege for a user on a database.
func (*Store) ShardGroupByTimestamp ¶
func (s *Store) ShardGroupByTimestamp(database, policy string, timestamp time.Time) (sgi *ShardGroupInfo, err error)
ShardGroupByTimestamp returns a shard group for a policy by timestamp.
func (*Store) ShardGroups ¶
func (s *Store) ShardGroups(database, policy string) (a []ShardGroupInfo, err error)
ShardGroups returns a list of all shard groups for a policy by timestamp.
func (*Store) ShardGroupsByTimeRange ¶
func (s *Store) ShardGroupsByTimeRange(database, policy string, tmin, tmax time.Time) (a []ShardGroupInfo, err error)
ShardGroupsByTimeRange returns a slice of ShardGroups that may contain data for the given time range. ShardGroups are sorted by start time.
func (*Store) ShardOwner ¶
func (s *Store) ShardOwner(shardID uint64) (database, policy string, sgi *ShardGroupInfo)
func (*Store) UpdateRetentionPolicy ¶
func (s *Store) UpdateRetentionPolicy(database, name string, rpu *RetentionPolicyUpdate) error
UpdateRetentionPolicy updates an existing retention policy.
func (*Store) UpdateUser ¶
UpdateUser updates an existing user in the store.
func (*Store) UserPrivilege ¶
UserPrivilege returns the privilege for a database.
func (*Store) UserPrivileges ¶
UserPrivileges returns a list of all databases.
func (*Store) VisitRetentionPolicies ¶
func (s *Store) VisitRetentionPolicies(f func(d DatabaseInfo, r RetentionPolicyInfo))
VisitRetentionPolicies calls the given function with full retention policy details.
func (*Store) WaitForDataChanged ¶
WaitForDataChanged will block the current goroutine until the metastore index has be updated.