client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2014 License: GPL-2.0 Imports: 10 Imported by: 0

README

influxdb-go

Documentation

Index

Constants

View Source
const (
	UDPMaxMessageSize = 2048
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(config *ClientConfig) (*Client, error)

func NewClient

func NewClient(config *ClientConfig) (*Client, error)

func (*Client) AlterDatabasePrivilege

func (self *Client) AlterDatabasePrivilege(database, name string, isAdmin bool, permissions ...string) error

func (*Client) AuthenticateClusterAdmin

func (self *Client) AuthenticateClusterAdmin(username, password string) error

func (*Client) AuthenticateDatabaseUser

func (self *Client) AuthenticateDatabaseUser(database, username, password string) error

func (*Client) ChangeClusterAdminPassword

func (self *Client) ChangeClusterAdminPassword(name, newPassword string) error

Change the cluster admin password

func (*Client) ChangeDatabaseUser

func (self *Client) ChangeDatabaseUser(database, name, newPassword string, isAdmin bool, newPermissions ...string) error

Change the user password, adming flag and optionally permissions

func (*Client) CreateClusterAdmin

func (self *Client) CreateClusterAdmin(name, password string) error

func (*Client) CreateDatabase

func (self *Client) CreateDatabase(name string) error

func (*Client) CreateDatabaseUser

func (self *Client) CreateDatabaseUser(database, name, password string, permissions ...string) error

Creates a new database user for the given database. permissions can be omitted in which case the user will be able to read and write to all time series. If provided, there should be two strings, the first for read and the second for write. The strings are regexes that are used to match the time series name to determine whether the user has the ability to read/write to the given time series.

client.CreateDatabaseUser("db", "user", "pass")
// the following user cannot read from any series and can write
// to the limited time series only
client.CreateDatabaseUser("db", "limited", "pass", "^$", "limited")

func (*Client) CreateShardSpace

func (self *Client) CreateShardSpace(database string, space *ShardSpace) error

Added to InfluxDB in 0.8.0

func (*Client) DeleteClusterAdmin

func (self *Client) DeleteClusterAdmin(name string) error

func (*Client) DeleteDatabase

func (self *Client) DeleteDatabase(name string) error

func (*Client) DeleteDatabaseUser

func (self *Client) DeleteDatabaseUser(database, name string) error

func (*Client) DisableCompression

func (self *Client) DisableCompression()

func (*Client) DropShard

func (self *Client) DropShard(id uint32, serverIds []uint32) error

func (*Client) DropShardSpace

func (self *Client) DropShardSpace(database, name string) error

Added to InfluxDB in 0.8.0

func (*Client) GetClusterAdminList

func (self *Client) GetClusterAdminList() ([]map[string]interface{}, error)

func (*Client) GetDatabaseList

func (self *Client) GetDatabaseList() ([]map[string]interface{}, error)

func (*Client) GetDatabaseUserList

func (self *Client) GetDatabaseUserList(database string) ([]map[string]interface{}, error)

func (*Client) GetShardSpaces

func (self *Client) GetShardSpaces() ([]*ShardSpace, error)

Added to InfluxDB in 0.8.0

func (*Client) GetShards

func (self *Client) GetShards() (*LongTermShortTermShards, error)

func (*Client) Ping

func (self *Client) Ping() error

func (*Client) Query

func (self *Client) Query(query string, precision ...TimePrecision) ([]*Series, error)

func (*Client) QueryWithNumbers

func (self *Client) QueryWithNumbers(query string, precision ...TimePrecision) ([]*Series, error)

func (*Client) RemoveServer

func (self *Client) RemoveServer(id int) error

func (*Client) Servers

func (self *Client) Servers() ([]map[string]interface{}, error)

func (*Client) UpdateClusterAdmin

func (self *Client) UpdateClusterAdmin(name, password string) error

func (*Client) UpdateDatabaseUser

func (self *Client) UpdateDatabaseUser(database, name, password string) error

func (*Client) UpdateDatabaseUserPermissions

func (self *Client) UpdateDatabaseUserPermissions(database, name, readPermission, writePermissions string) error

func (*Client) UpdateShardSpace

func (self *Client) UpdateShardSpace(database, name string, space *ShardSpace) error

Added to InfluxDB in 0.8.2

func (*Client) WriteSeries

func (self *Client) WriteSeries(series []*Series) error

func (*Client) WriteSeriesOverUDP

func (self *Client) WriteSeriesOverUDP(series []*Series) error

func (*Client) WriteSeriesWithTimePrecision

func (self *Client) WriteSeriesWithTimePrecision(series []*Series, timePrecision TimePrecision) error

type ClientConfig

type ClientConfig struct {
	Host       string
	Username   string
	Password   string
	Database   string
	HttpClient *http.Client
	IsSecure   bool
	IsUDP      bool
}

type LongTermShortTermShards

type LongTermShortTermShards struct {
	// Long term shards, (doesn't get populated for version >= 0.8.0)
	LongTerm []*Shard `json:"longTerm"`
	// Short term shards, (doesn't get populated for version >= 0.8.0)
	ShortTerm []*Shard `json:"shortTerm"`
	// All shards in the system (Long + Short term shards for version < 0.8.0)
	All []*Shard `json:"-"`
}

type Series

type Series struct {
	Name    string          `json:"name"`
	Columns []string        `json:"columns"`
	Points  [][]interface{} `json:"points"`
}

func (*Series) GetColumns

func (self *Series) GetColumns() []string

func (*Series) GetName

func (self *Series) GetName() string

func (*Series) GetPoints

func (self *Series) GetPoints() [][]interface{}

type Shard

type Shard struct {
	Id        uint32   `json:"id"`
	EndTime   int64    `json:"endTime"`
	StartTime int64    `json:"startTime"`
	ServerIds []uint32 `json:"serverIds"`
	SpaceName string   `json:"spaceName"`
	Database  string   `json:"database"`
}

type ShardSpace

type ShardSpace struct {
	// required, must be unique within the database
	Name string `json:"name"`
	// required, a database has many shard spaces and a shard space belongs to a database
	Database string `json:"database"`
	// this is optional, if they don't set it, we'll set to /.*/
	Regex string `json:"regex"`
	// this is optional, if they don't set it, it will default to the storage.dir in the config
	RetentionPolicy   string `json:"retentionPolicy"`
	ShardDuration     string `json:"shardDuration"`
	ReplicationFactor uint32 `json:"replicationFactor"`
	Split             uint32 `json:"split"`
}

type ShardSpaceCollection

type ShardSpaceCollection struct {
	ShardSpaces []ShardSpace
}

type TimePrecision

type TimePrecision string
const (
	Second      TimePrecision = "s"
	Millisecond TimePrecision = "ms"
	Microsecond TimePrecision = "u"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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