bolt

package
v2.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultOrganizationName is the Name of the default organization
	DefaultOrganizationName string = "Default"
	// DefaultOrganizationRole is the DefaultRole for the Default organization
	DefaultOrganizationRole string = "member"
)

Variables

View Source
var (
	// OrganizationsBucket is the bucket where organizations are stored.
	OrganizationsBucket = []byte("OrganizationsV1")
	// DefaultOrganizationID is the ID of the default organization.
	DefaultOrganizationID = []byte("default")
)
View Source
var BuildBucket = []byte("Build")

BuildBucket is the bolt bucket used to store Chronograf build information

View Source
var BuildKey = []byte("build")

BuildKey is the constant key used in the bolt bucket

View Source
var ConfigBucket = []byte("ConfigV1")

ConfigBucket is used to store chronograf application state

View Source
var DashboardsBucket = []byte("Dashoard") // N.B. leave the misspelling for backwards-compat!

DashboardsBucket is the bolt bucket dashboards are stored in

View Source
var DefaultSource = &chronograf.Source{
	ID:      math.MaxInt32,
	Name:    "autogen",
	Type:    "influx",
	URL:     "http://localhost:8086",
	Default: false,
}

DefaultSource is a temporary measure for single-binary.

View Source
var LayoutsBucket = []byte("Layout")

LayoutsBucket is the bolt bucket layouts are stored in

View Source
var (
	// MappingsBucket is the bucket where organizations are stored.
	MappingsBucket = []byte("MappingsV1")
)
View Source
var OrganizationConfigBucket = []byte("OrganizationConfigV1")

OrganizationConfigBucket is used to store chronograf organization configurations

View Source
var SchemaVersionBucket = []byte("SchemaVersions")

SchemaVersionBucket stores ids of completed migrations

View Source
var ServersBucket = []byte("Servers")

ServersBucket is the bolt bucket to store lists of servers

View Source
var SourcesBucket = []byte("Sources")

SourcesBucket is the bolt bucket used to store source information

View Source
var UsersBucket = []byte("UsersV2")

UsersBucket is used to store users local to chronograf

Functions

func IsMigrationComplete

func IsMigrationComplete(db *bolt.DB, id string) (bool, error)

IsMigrationComplete checks for the presence of a particular migration id

func MarkMigrationAsComplete

func MarkMigrationAsComplete(db *bolt.DB, id string) error

MarkMigrationAsComplete adds the migration id to the schema bucket

func MigrateAll

func MigrateAll(client *Client) error

MigrateAll iterates through all known migrations and runs them in order

Types

type AlertRule

type AlertRule struct {
	ID     string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
	JSON   string `protobuf:"bytes,2,opt,name=JSON,proto3" json:"JSON,omitempty"`
	SrcID  int64  `protobuf:"varint,3,opt,name=SrcID,proto3" json:"SrcID,omitempty"`
	KapaID int64  `protobuf:"varint,4,opt,name=KapaID,proto3" json:"KapaID,omitempty"`
}

func (*AlertRule) Descriptor

func (*AlertRule) Descriptor() ([]byte, []int)

func (*AlertRule) GetID

func (m *AlertRule) GetID() string

func (*AlertRule) GetJSON

func (m *AlertRule) GetJSON() string

func (*AlertRule) GetKapaID

func (m *AlertRule) GetKapaID() int64

func (*AlertRule) GetSrcID

func (m *AlertRule) GetSrcID() int64

func (*AlertRule) ProtoMessage

func (*AlertRule) ProtoMessage()

func (*AlertRule) Reset

func (m *AlertRule) Reset()

func (*AlertRule) String

func (m *AlertRule) String() string

type AuthConfig

type AuthConfig struct {
	SuperAdminNewUsers bool `protobuf:"varint,1,opt,name=SuperAdminNewUsers,proto3" json:"SuperAdminNewUsers,omitempty"`
}

func (*AuthConfig) Descriptor

func (*AuthConfig) Descriptor() ([]byte, []int)

func (*AuthConfig) GetSuperAdminNewUsers

func (m *AuthConfig) GetSuperAdminNewUsers() bool

func (*AuthConfig) ProtoMessage

func (*AuthConfig) ProtoMessage()

func (*AuthConfig) Reset

func (m *AuthConfig) Reset()

func (*AuthConfig) String

func (m *AuthConfig) String() string

type Axis

type Axis struct {
	LegacyBounds []int64  `protobuf:"varint,1,rep,packed,name=legacyBounds" json:"legacyBounds,omitempty"`
	Bounds       []string `protobuf:"bytes,2,rep,name=bounds" json:"bounds,omitempty"`
	Label        string   `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"`
	Prefix       string   `protobuf:"bytes,4,opt,name=prefix,proto3" json:"prefix,omitempty"`
	Suffix       string   `protobuf:"bytes,5,opt,name=suffix,proto3" json:"suffix,omitempty"`
	Base         string   `protobuf:"bytes,6,opt,name=base,proto3" json:"base,omitempty"`
	Scale        string   `protobuf:"bytes,7,opt,name=scale,proto3" json:"scale,omitempty"`
}

func (*Axis) Descriptor

func (*Axis) Descriptor() ([]byte, []int)

func (*Axis) GetBase

func (m *Axis) GetBase() string

func (*Axis) GetBounds

func (m *Axis) GetBounds() []string

func (*Axis) GetLabel

func (m *Axis) GetLabel() string

func (*Axis) GetLegacyBounds

func (m *Axis) GetLegacyBounds() []int64

func (*Axis) GetPrefix

func (m *Axis) GetPrefix() string

func (*Axis) GetScale

func (m *Axis) GetScale() string

func (*Axis) GetSuffix

func (m *Axis) GetSuffix() string

func (*Axis) ProtoMessage

func (*Axis) ProtoMessage()

func (*Axis) Reset

func (m *Axis) Reset()

func (*Axis) String

func (m *Axis) String() string

type Backup

type Backup struct {
}

Backup tells Open to perform a backup prior to initialization

func (Backup) Backup

func (b Backup) Backup() bool

Backup returns true

type BuildInfo

type BuildInfo struct {
	Version string `protobuf:"bytes,1,opt,name=Version,proto3" json:"Version,omitempty"`
	Commit  string `protobuf:"bytes,2,opt,name=Commit,proto3" json:"Commit,omitempty"`
}

func (*BuildInfo) Descriptor

func (*BuildInfo) Descriptor() ([]byte, []int)

func (*BuildInfo) GetCommit

func (m *BuildInfo) GetCommit() string

func (*BuildInfo) GetVersion

func (m *BuildInfo) GetVersion() string

func (*BuildInfo) ProtoMessage

func (*BuildInfo) ProtoMessage()

func (*BuildInfo) Reset

func (m *BuildInfo) Reset()

func (*BuildInfo) String

func (m *BuildInfo) String() string

type BuildStore

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

BuildStore is a bolt implementation to store Chronograf build information

func (*BuildStore) Get

Get retrieves Chronograf build information from the database

func (*BuildStore) Migrate

func (s *BuildStore) Migrate(ctx context.Context, build chronograf.BuildInfo) error

Migrate simply stores the current version in the database

func (*BuildStore) Update

func (s *BuildStore) Update(ctx context.Context, build chronograf.BuildInfo) error

Update overwrites the current Chronograf build information in the database

type Cell

type Cell struct {
	X       int32            `protobuf:"varint,1,opt,name=x,proto3" json:"x,omitempty"`
	Y       int32            `protobuf:"varint,2,opt,name=y,proto3" json:"y,omitempty"`
	W       int32            `protobuf:"varint,3,opt,name=w,proto3" json:"w,omitempty"`
	H       int32            `protobuf:"varint,4,opt,name=h,proto3" json:"h,omitempty"`
	Queries []*Query         `protobuf:"bytes,5,rep,name=queries" json:"queries,omitempty"`
	I       string           `protobuf:"bytes,6,opt,name=i,proto3" json:"i,omitempty"`
	Name    string           `protobuf:"bytes,7,opt,name=name,proto3" json:"name,omitempty"`
	Yranges []int64          `protobuf:"varint,8,rep,packed,name=yranges" json:"yranges,omitempty"`
	Ylabels []string         `protobuf:"bytes,9,rep,name=ylabels" json:"ylabels,omitempty"`
	Type    string           `protobuf:"bytes,10,opt,name=type,proto3" json:"type,omitempty"`
	Axes    map[string]*Axis `` /* 136-byte string literal not displayed */
}

func (*Cell) Descriptor

func (*Cell) Descriptor() ([]byte, []int)

func (*Cell) GetAxes

func (m *Cell) GetAxes() map[string]*Axis

func (*Cell) GetH

func (m *Cell) GetH() int32

func (*Cell) GetI

func (m *Cell) GetI() string

func (*Cell) GetName

func (m *Cell) GetName() string

func (*Cell) GetQueries

func (m *Cell) GetQueries() []*Query

func (*Cell) GetType

func (m *Cell) GetType() string

func (*Cell) GetW

func (m *Cell) GetW() int32

func (*Cell) GetX

func (m *Cell) GetX() int32

func (*Cell) GetY

func (m *Cell) GetY() int32

func (*Cell) GetYlabels

func (m *Cell) GetYlabels() []string

func (*Cell) GetYranges

func (m *Cell) GetYranges() []int64

func (*Cell) ProtoMessage

func (*Cell) ProtoMessage()

func (*Cell) Reset

func (m *Cell) Reset()

func (*Cell) String

func (m *Cell) String() string

type Client

type Client struct {
	Path string

	Now       func() time.Time
	LayoutIDs chronograf.ID

	BuildStore              *BuildStore
	SourcesStore            *SourcesStore
	ServersStore            *ServersStore
	LayoutsStore            *LayoutsStore
	DashboardsStore         *DashboardsStore
	UsersStore              *UsersStore
	OrganizationsStore      *OrganizationsStore
	ConfigStore             *ConfigStore
	MappingsStore           *MappingsStore
	OrganizationConfigStore *OrganizationConfigStore
	// contains filtered or unexported fields
}

Client is a client for the boltDB data store.

func NewClient

func NewClient() *Client

NewClient initializes all stores

func (*Client) Close

func (c *Client) Close() error

Close the connection to the bolt database

func (*Client) Open

func (c *Client) Open(ctx context.Context, logger chronograf.Logger, build chronograf.BuildInfo, opts ...Option) error

Open / create boltDB file.

func (*Client) WithDB

func (c *Client) WithDB(db *bolt.DB)

WithDB sets the boltdb database for a client. It should not be called after a call to Open.

type Color

type Color struct {
	ID    string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Type  string `protobuf:"bytes,2,opt,name=Type,proto3" json:"Type,omitempty"`
	Hex   string `protobuf:"bytes,3,opt,name=Hex,proto3" json:"Hex,omitempty"`
	Name  string `protobuf:"bytes,4,opt,name=Name,proto3" json:"Name,omitempty"`
	Value string `protobuf:"bytes,5,opt,name=Value,proto3" json:"Value,omitempty"`
}

func (*Color) Descriptor

func (*Color) Descriptor() ([]byte, []int)

func (*Color) GetHex

func (m *Color) GetHex() string

func (*Color) GetID

func (m *Color) GetID() string

func (*Color) GetName

func (m *Color) GetName() string

func (*Color) GetType

func (m *Color) GetType() string

func (*Color) GetValue

func (m *Color) GetValue() string

func (*Color) ProtoMessage

func (*Color) ProtoMessage()

func (*Color) Reset

func (m *Color) Reset()

func (*Color) String

func (m *Color) String() string

type Config

type Config struct {
	Auth *AuthConfig `protobuf:"bytes,1,opt,name=Auth" json:"Auth,omitempty"`
}

func (*Config) Descriptor

func (*Config) Descriptor() ([]byte, []int)

func (*Config) GetAuth

func (m *Config) GetAuth() *AuthConfig

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (m *Config) Reset()

func (*Config) String

func (m *Config) String() string

type ConfigStore

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

ConfigStore uses bolt to store and retrieve global application configuration

func (*ConfigStore) Get

func (*ConfigStore) Initialize

func (s *ConfigStore) Initialize(ctx context.Context) error

func (*ConfigStore) Migrate

func (s *ConfigStore) Migrate(ctx context.Context) error

func (*ConfigStore) Update

func (s *ConfigStore) Update(ctx context.Context, cfg *chronograf.Config) error

type Dashboard

type Dashboard struct {
	ID           int64            `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Name         string           `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
	Cells        []*DashboardCell `protobuf:"bytes,3,rep,name=cells" json:"cells,omitempty"`
	Templates    []*Template      `protobuf:"bytes,4,rep,name=templates" json:"templates,omitempty"`
	Organization string           `protobuf:"bytes,5,opt,name=Organization,proto3" json:"Organization,omitempty"`
}

func (*Dashboard) Descriptor

func (*Dashboard) Descriptor() ([]byte, []int)

func (*Dashboard) GetCells

func (m *Dashboard) GetCells() []*DashboardCell

func (*Dashboard) GetID

func (m *Dashboard) GetID() int64

func (*Dashboard) GetName

func (m *Dashboard) GetName() string

func (*Dashboard) GetOrganization

func (m *Dashboard) GetOrganization() string

func (*Dashboard) GetTemplates

func (m *Dashboard) GetTemplates() []*Template

func (*Dashboard) ProtoMessage

func (*Dashboard) ProtoMessage()

func (*Dashboard) Reset

func (m *Dashboard) Reset()

func (*Dashboard) String

func (m *Dashboard) String() string

type DashboardCell

type DashboardCell struct {
	X            int32            `protobuf:"varint,1,opt,name=x,proto3" json:"x,omitempty"`
	Y            int32            `protobuf:"varint,2,opt,name=y,proto3" json:"y,omitempty"`
	W            int32            `protobuf:"varint,3,opt,name=w,proto3" json:"w,omitempty"`
	H            int32            `protobuf:"varint,4,opt,name=h,proto3" json:"h,omitempty"`
	Queries      []*Query         `protobuf:"bytes,5,rep,name=queries" json:"queries,omitempty"`
	Name         string           `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"`
	Type         string           `protobuf:"bytes,7,opt,name=type,proto3" json:"type,omitempty"`
	ID           string           `protobuf:"bytes,8,opt,name=ID,proto3" json:"ID,omitempty"`
	Axes         map[string]*Axis `` /* 135-byte string literal not displayed */
	Colors       []*Color         `protobuf:"bytes,10,rep,name=colors" json:"colors,omitempty"`
	Legend       *Legend          `protobuf:"bytes,11,opt,name=legend" json:"legend,omitempty"`
	TableOptions *TableOptions    `protobuf:"bytes,12,opt,name=tableOptions" json:"tableOptions,omitempty"`
}

func (*DashboardCell) Descriptor

func (*DashboardCell) Descriptor() ([]byte, []int)

func (*DashboardCell) GetAxes

func (m *DashboardCell) GetAxes() map[string]*Axis

func (*DashboardCell) GetColors

func (m *DashboardCell) GetColors() []*Color

func (*DashboardCell) GetH

func (m *DashboardCell) GetH() int32

func (*DashboardCell) GetID

func (m *DashboardCell) GetID() string

func (*DashboardCell) GetLegend

func (m *DashboardCell) GetLegend() *Legend

func (*DashboardCell) GetName

func (m *DashboardCell) GetName() string

func (*DashboardCell) GetQueries

func (m *DashboardCell) GetQueries() []*Query

func (*DashboardCell) GetTableOptions

func (m *DashboardCell) GetTableOptions() *TableOptions

func (*DashboardCell) GetType

func (m *DashboardCell) GetType() string

func (*DashboardCell) GetW

func (m *DashboardCell) GetW() int32

func (*DashboardCell) GetX

func (m *DashboardCell) GetX() int32

func (*DashboardCell) GetY

func (m *DashboardCell) GetY() int32

func (*DashboardCell) ProtoMessage

func (*DashboardCell) ProtoMessage()

func (*DashboardCell) Reset

func (m *DashboardCell) Reset()

func (*DashboardCell) String

func (m *DashboardCell) String() string

type DashboardsStore

type DashboardsStore struct {
	IDs chronograf.ID
	// contains filtered or unexported fields
}

DashboardsStore is the bolt implementation of storing dashboards

func (*DashboardsStore) Add

Add creates a new Dashboard in the DashboardsStore

func (*DashboardsStore) AddIDs

func (d *DashboardsStore) AddIDs(ctx context.Context, boards []chronograf.Dashboard) error

AddIDs is a migration function that adds ID information to existing dashboards

func (*DashboardsStore) All

All returns all known dashboards

func (*DashboardsStore) Delete

Delete the dashboard from DashboardsStore

func (*DashboardsStore) Get

Get returns a Dashboard if the id exists.

func (*DashboardsStore) Migrate

func (d *DashboardsStore) Migrate(ctx context.Context) error

Migrate updates the dashboards at runtime

func (*DashboardsStore) Update

Update the dashboard in DashboardsStore

type Layout

type Layout struct {
	ID          string  `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Application string  `protobuf:"bytes,2,opt,name=Application,proto3" json:"Application,omitempty"`
	Measurement string  `protobuf:"bytes,3,opt,name=Measurement,proto3" json:"Measurement,omitempty"`
	Cells       []*Cell `protobuf:"bytes,4,rep,name=Cells" json:"Cells,omitempty"`
	Autoflow    bool    `protobuf:"varint,5,opt,name=Autoflow,proto3" json:"Autoflow,omitempty"`
}

func (*Layout) Descriptor

func (*Layout) Descriptor() ([]byte, []int)

func (*Layout) GetApplication

func (m *Layout) GetApplication() string

func (*Layout) GetAutoflow

func (m *Layout) GetAutoflow() bool

func (*Layout) GetCells

func (m *Layout) GetCells() []*Cell

func (*Layout) GetID

func (m *Layout) GetID() string

func (*Layout) GetMeasurement

func (m *Layout) GetMeasurement() string

func (*Layout) ProtoMessage

func (*Layout) ProtoMessage()

func (*Layout) Reset

func (m *Layout) Reset()

func (*Layout) String

func (m *Layout) String() string

type LayoutsStore

type LayoutsStore struct {
	IDs chronograf.ID
	// contains filtered or unexported fields
}

LayoutsStore is the bolt implementation to store layouts

func (*LayoutsStore) Add

Add creates a new Layout in the LayoutsStore.

func (*LayoutsStore) All

All returns all known layouts

func (*LayoutsStore) Delete

func (s *LayoutsStore) Delete(ctx context.Context, src chronograf.Layout) error

Delete removes the Layout from the LayoutsStore

func (*LayoutsStore) Get

Get returns a Layout if the id exists.

func (*LayoutsStore) Migrate

func (s *LayoutsStore) Migrate(ctx context.Context) error

func (*LayoutsStore) Update

func (s *LayoutsStore) Update(ctx context.Context, src chronograf.Layout) error

Update a Layout

type Legend

type Legend struct {
	Type        string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"`
	Orientation string `protobuf:"bytes,2,opt,name=Orientation,proto3" json:"Orientation,omitempty"`
}

func (*Legend) Descriptor

func (*Legend) Descriptor() ([]byte, []int)

func (*Legend) GetOrientation

func (m *Legend) GetOrientation() string

func (*Legend) GetType

func (m *Legend) GetType() string

func (*Legend) ProtoMessage

func (*Legend) ProtoMessage()

func (*Legend) Reset

func (m *Legend) Reset()

func (*Legend) String

func (m *Legend) String() string

type Mapping

type Mapping struct {
	Provider             string `protobuf:"bytes,1,opt,name=Provider,proto3" json:"Provider,omitempty"`
	Scheme               string `protobuf:"bytes,2,opt,name=Scheme,proto3" json:"Scheme,omitempty"`
	ProviderOrganization string `protobuf:"bytes,3,opt,name=ProviderOrganization,proto3" json:"ProviderOrganization,omitempty"`
	ID                   string `protobuf:"bytes,4,opt,name=ID,proto3" json:"ID,omitempty"`
	Organization         string `protobuf:"bytes,5,opt,name=Organization,proto3" json:"Organization,omitempty"`
}

func (*Mapping) Descriptor

func (*Mapping) Descriptor() ([]byte, []int)

func (*Mapping) GetID

func (m *Mapping) GetID() string

func (*Mapping) GetOrganization

func (m *Mapping) GetOrganization() string

func (*Mapping) GetProvider

func (m *Mapping) GetProvider() string

func (*Mapping) GetProviderOrganization

func (m *Mapping) GetProviderOrganization() string

func (*Mapping) GetScheme

func (m *Mapping) GetScheme() string

func (*Mapping) ProtoMessage

func (*Mapping) ProtoMessage()

func (*Mapping) Reset

func (m *Mapping) Reset()

func (*Mapping) String

func (m *Mapping) String() string

type MappingsStore

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

MappingsStore uses bolt to store and retrieve Mappings

func (*MappingsStore) Add

Add creates a new Mapping in the MappingsStore

func (*MappingsStore) All

All returns all known organizations

func (*MappingsStore) Delete

func (s *MappingsStore) Delete(ctx context.Context, o *chronograf.Mapping) error

Delete the organization from MappingsStore

func (*MappingsStore) Get

Get returns a Mapping if the id exists.

func (*MappingsStore) Migrate

func (s *MappingsStore) Migrate(ctx context.Context) error

Migrate sets the default organization at runtime

func (*MappingsStore) Update

func (s *MappingsStore) Update(ctx context.Context, o *chronograf.Mapping) error

Update the organization in MappingsStore

type Migration

type Migration struct {
	ID   string
	Up   func(db *bolt.DB) error
	Down func(db *bolt.DB) error
}

Migration defines a database state/schema transition

 ID: 	After the migration is run, this id is stored in the database.
     	We don't want to run a state transition twice
 Up: 	The forward-transition function. After a version upgrade, a number
				of these will run on database startup in order to bring a user's
				schema in line with struct definitions in the new version.
 Down: The backward-transition function. We don't expect these to be
				run on a user's database -- if the user needs to rollback
				to a previous version, it will be easier for them to replace
				their current database with one of their backups. The primary
				purpose of a Down() function is to help contributors move across
				development branches that have different schema definitions.

func (Migration) Migrate

func (m Migration) Migrate(client *Client) error

Migrate runs one migration's Up() function, if it has not already been run

type Option

type Option interface {
	Backup() bool
}

Option to change behavior of Open()

func WithBackup

func WithBackup() Option

WithBackup returns a Backup

type Organization

type Organization struct {
	ID          string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Name        string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
	DefaultRole string `protobuf:"bytes,3,opt,name=DefaultRole,proto3" json:"DefaultRole,omitempty"`
}

func (*Organization) Descriptor

func (*Organization) Descriptor() ([]byte, []int)

func (*Organization) GetDefaultRole

func (m *Organization) GetDefaultRole() string

func (*Organization) GetID

func (m *Organization) GetID() string

func (*Organization) GetName

func (m *Organization) GetName() string

func (*Organization) ProtoMessage

func (*Organization) ProtoMessage()

func (*Organization) Reset

func (m *Organization) Reset()

func (*Organization) String

func (m *Organization) String() string

type OrganizationConfigStore

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

OrganizationConfigStore uses bolt to store and retrieve organization configurations

func (*OrganizationConfigStore) FindOrCreate

FindOrCreate gets an OrganizationConfig from the store or creates one if none exists for this organization

func (*OrganizationConfigStore) Get

Get retrieves an OrganizationConfig from the store

func (*OrganizationConfigStore) Migrate

func (s *OrganizationConfigStore) Migrate(ctx context.Context) error

func (*OrganizationConfigStore) Put

Put replaces the OrganizationConfig in the store

type OrganizationsStore

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

OrganizationsStore uses bolt to store and retrieve Organizations

func (*OrganizationsStore) Add

Add creates a new Organization in the OrganizationsStore

func (*OrganizationsStore) All

All returns all known organizations

func (*OrganizationsStore) CreateDefault

func (s *OrganizationsStore) CreateDefault(ctx context.Context) error

CreateDefault does a findOrCreate on the default organization

func (*OrganizationsStore) DefaultOrganization

func (s *OrganizationsStore) DefaultOrganization(ctx context.Context) (*chronograf.Organization, error)

DefaultOrganizationID returns the ID of the default organization

func (*OrganizationsStore) Delete

Delete the organization from OrganizationsStore

func (*OrganizationsStore) Get

Get returns a Organization if the id exists. If an ID is provided in the query, the lookup time for an organization will be O(1). If Name is provided, the lookup time will be O(n). Get expects that only one of ID or Name will be specified, but will prefer ID over Name if both are specified.

func (*OrganizationsStore) Migrate

func (s *OrganizationsStore) Migrate(ctx context.Context) error

Migrate sets the default organization at runtime

func (*OrganizationsStore) Update

Update the organization in OrganizationsStore

type Query

type Query struct {
	Command  string       `protobuf:"bytes,1,opt,name=Command,proto3" json:"Command,omitempty"`
	DB       string       `protobuf:"bytes,2,opt,name=DB,proto3" json:"DB,omitempty"`
	RP       string       `protobuf:"bytes,3,opt,name=RP,proto3" json:"RP,omitempty"`
	GroupBys []string     `protobuf:"bytes,4,rep,name=GroupBys" json:"GroupBys,omitempty"`
	Wheres   []string     `protobuf:"bytes,5,rep,name=Wheres" json:"Wheres,omitempty"`
	Label    string       `protobuf:"bytes,6,opt,name=Label,proto3" json:"Label,omitempty"`
	Range    *Range       `protobuf:"bytes,7,opt,name=Range" json:"Range,omitempty"`
	Source   string       `protobuf:"bytes,8,opt,name=Source,proto3" json:"Source,omitempty"`
	Shifts   []*TimeShift `protobuf:"bytes,9,rep,name=Shifts" json:"Shifts,omitempty"`
}

func (*Query) Descriptor

func (*Query) Descriptor() ([]byte, []int)

func (*Query) GetCommand

func (m *Query) GetCommand() string

func (*Query) GetDB

func (m *Query) GetDB() string

func (*Query) GetGroupBys

func (m *Query) GetGroupBys() []string

func (*Query) GetLabel

func (m *Query) GetLabel() string

func (*Query) GetRP

func (m *Query) GetRP() string

func (*Query) GetRange

func (m *Query) GetRange() *Range

func (*Query) GetShifts

func (m *Query) GetShifts() []*TimeShift

func (*Query) GetSource

func (m *Query) GetSource() string

func (*Query) GetWheres

func (m *Query) GetWheres() []string

func (*Query) ProtoMessage

func (*Query) ProtoMessage()

func (*Query) Reset

func (m *Query) Reset()

func (*Query) String

func (m *Query) String() string

type Range

type Range struct {
	Upper int64 `protobuf:"varint,1,opt,name=Upper,proto3" json:"Upper,omitempty"`
	Lower int64 `protobuf:"varint,2,opt,name=Lower,proto3" json:"Lower,omitempty"`
}

func (*Range) Descriptor

func (*Range) Descriptor() ([]byte, []int)

func (*Range) GetLower

func (m *Range) GetLower() int64

func (*Range) GetUpper

func (m *Range) GetUpper() int64

func (*Range) ProtoMessage

func (*Range) ProtoMessage()

func (*Range) Reset

func (m *Range) Reset()

func (*Range) String

func (m *Range) String() string

type RenamableField

type RenamableField struct {
	InternalName string `protobuf:"bytes,1,opt,name=internalName,proto3" json:"internalName,omitempty"`
	DisplayName  string `protobuf:"bytes,2,opt,name=displayName,proto3" json:"displayName,omitempty"`
	Visible      bool   `protobuf:"varint,3,opt,name=visible,proto3" json:"visible,omitempty"`
}

func (*RenamableField) Descriptor

func (*RenamableField) Descriptor() ([]byte, []int)

func (*RenamableField) GetDisplayName

func (m *RenamableField) GetDisplayName() string

func (*RenamableField) GetInternalName

func (m *RenamableField) GetInternalName() string

func (*RenamableField) GetVisible

func (m *RenamableField) GetVisible() bool

func (*RenamableField) ProtoMessage

func (*RenamableField) ProtoMessage()

func (*RenamableField) Reset

func (m *RenamableField) Reset()

func (*RenamableField) String

func (m *RenamableField) String() string

type Role

type Role struct {
	Organization string `protobuf:"bytes,1,opt,name=Organization,proto3" json:"Organization,omitempty"`
	Name         string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
}

func (*Role) Descriptor

func (*Role) Descriptor() ([]byte, []int)

func (*Role) GetName

func (m *Role) GetName() string

func (*Role) GetOrganization

func (m *Role) GetOrganization() string

func (*Role) ProtoMessage

func (*Role) ProtoMessage()

func (*Role) Reset

func (m *Role) Reset()

func (*Role) String

func (m *Role) String() string

type Server

type Server struct {
	ID                 int64  `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Name               string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
	Username           string `protobuf:"bytes,3,opt,name=Username,proto3" json:"Username,omitempty"`
	Password           string `protobuf:"bytes,4,opt,name=Password,proto3" json:"Password,omitempty"`
	URL                string `protobuf:"bytes,5,opt,name=URL,proto3" json:"URL,omitempty"`
	SrcID              int64  `protobuf:"varint,6,opt,name=SrcID,proto3" json:"SrcID,omitempty"`
	Active             bool   `protobuf:"varint,7,opt,name=Active,proto3" json:"Active,omitempty"`
	Organization       string `protobuf:"bytes,8,opt,name=Organization,proto3" json:"Organization,omitempty"`
	InsecureSkipVerify bool   `protobuf:"varint,9,opt,name=InsecureSkipVerify,proto3" json:"InsecureSkipVerify,omitempty"`
}

func (*Server) Descriptor

func (*Server) Descriptor() ([]byte, []int)

func (*Server) GetActive

func (m *Server) GetActive() bool

func (*Server) GetID

func (m *Server) GetID() int64

func (*Server) GetInsecureSkipVerify

func (m *Server) GetInsecureSkipVerify() bool

func (*Server) GetName

func (m *Server) GetName() string

func (*Server) GetOrganization

func (m *Server) GetOrganization() string

func (*Server) GetPassword

func (m *Server) GetPassword() string

func (*Server) GetSrcID

func (m *Server) GetSrcID() int64

func (*Server) GetURL

func (m *Server) GetURL() string

func (*Server) GetUsername

func (m *Server) GetUsername() string

func (*Server) ProtoMessage

func (*Server) ProtoMessage()

func (*Server) Reset

func (m *Server) Reset()

func (*Server) String

func (m *Server) String() string

type ServersStore

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

ServersStore is the bolt implementation to store servers in a store. Used store servers that are associated in some way with a source

func (*ServersStore) Add

Add creates a new Server in the ServerStore.

func (*ServersStore) All

All returns all known servers

func (*ServersStore) Delete

func (s *ServersStore) Delete(ctx context.Context, src chronograf.Server) error

Delete removes the Server from the ServersStore

func (*ServersStore) Get

func (s *ServersStore) Get(ctx context.Context, id int) (chronograf.Server, error)

Get returns a Server if the id exists.

func (*ServersStore) Migrate

func (s *ServersStore) Migrate(ctx context.Context) error

func (*ServersStore) Update

func (s *ServersStore) Update(ctx context.Context, src chronograf.Server) error

Update a Server

type Source

type Source struct {
	ID                 int64  `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Name               string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
	Type               string `protobuf:"bytes,3,opt,name=Type,proto3" json:"Type,omitempty"`
	Username           string `protobuf:"bytes,4,opt,name=Username,proto3" json:"Username,omitempty"`
	Password           string `protobuf:"bytes,5,opt,name=Password,proto3" json:"Password,omitempty"`
	URL                string `protobuf:"bytes,6,opt,name=URL,proto3" json:"URL,omitempty"`
	Default            bool   `protobuf:"varint,7,opt,name=Default,proto3" json:"Default,omitempty"`
	Telegraf           string `protobuf:"bytes,8,opt,name=Telegraf,proto3" json:"Telegraf,omitempty"`
	InsecureSkipVerify bool   `protobuf:"varint,9,opt,name=InsecureSkipVerify,proto3" json:"InsecureSkipVerify,omitempty"`
	MetaURL            string `protobuf:"bytes,10,opt,name=MetaURL,proto3" json:"MetaURL,omitempty"`
	SharedSecret       string `protobuf:"bytes,11,opt,name=SharedSecret,proto3" json:"SharedSecret,omitempty"`
	Organization       string `protobuf:"bytes,12,opt,name=Organization,proto3" json:"Organization,omitempty"`
	Role               string `protobuf:"bytes,13,opt,name=Role,proto3" json:"Role,omitempty"`
}

func (*Source) Descriptor

func (*Source) Descriptor() ([]byte, []int)

func (*Source) GetDefault

func (m *Source) GetDefault() bool

func (*Source) GetID

func (m *Source) GetID() int64

func (*Source) GetInsecureSkipVerify

func (m *Source) GetInsecureSkipVerify() bool

func (*Source) GetMetaURL

func (m *Source) GetMetaURL() string

func (*Source) GetName

func (m *Source) GetName() string

func (*Source) GetOrganization

func (m *Source) GetOrganization() string

func (*Source) GetPassword

func (m *Source) GetPassword() string

func (*Source) GetRole

func (m *Source) GetRole() string

func (*Source) GetSharedSecret

func (m *Source) GetSharedSecret() string

func (*Source) GetTelegraf

func (m *Source) GetTelegraf() string

func (*Source) GetType

func (m *Source) GetType() string

func (*Source) GetURL

func (m *Source) GetURL() string

func (*Source) GetUsername

func (m *Source) GetUsername() string

func (*Source) ProtoMessage

func (*Source) ProtoMessage()

func (*Source) Reset

func (m *Source) Reset()

func (*Source) String

func (m *Source) String() string

type SourcesStore

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

SourcesStore is a bolt implementation to store time-series source information.

func (*SourcesStore) Add

Add creates a new Source in the SourceStore.

func (*SourcesStore) All

All returns all known sources

func (*SourcesStore) Delete

func (s *SourcesStore) Delete(ctx context.Context, src chronograf.Source) error

Delete removes the Source from the SourcesStore

func (*SourcesStore) Get

func (s *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error)

Get returns a Source if the id exists.

func (*SourcesStore) Migrate

func (s *SourcesStore) Migrate(ctx context.Context) error

Migrate adds the default source to an existing boltdb.

func (*SourcesStore) Put

func (s *SourcesStore) Put(ctx context.Context, src *chronograf.Source) error

Put updates the source.

func (*SourcesStore) Update

func (s *SourcesStore) Update(ctx context.Context, src chronograf.Source) error

Update a Source

type TableOptions

type TableOptions struct {
	VerticalTimeAxis bool              `protobuf:"varint,2,opt,name=verticalTimeAxis,proto3" json:"verticalTimeAxis,omitempty"`
	SortBy           *RenamableField   `protobuf:"bytes,3,opt,name=sortBy" json:"sortBy,omitempty"`
	Wrapping         string            `protobuf:"bytes,4,opt,name=wrapping,proto3" json:"wrapping,omitempty"`
	FieldNames       []*RenamableField `protobuf:"bytes,5,rep,name=fieldNames" json:"fieldNames,omitempty"`
	FixFirstColumn   bool              `protobuf:"varint,6,opt,name=fixFirstColumn,proto3" json:"fixFirstColumn,omitempty"`
}

func (*TableOptions) Descriptor

func (*TableOptions) Descriptor() ([]byte, []int)

func (*TableOptions) GetFieldNames

func (m *TableOptions) GetFieldNames() []*RenamableField

func (*TableOptions) GetFixFirstColumn

func (m *TableOptions) GetFixFirstColumn() bool

func (*TableOptions) GetSortBy

func (m *TableOptions) GetSortBy() *RenamableField

func (*TableOptions) GetVerticalTimeAxis

func (m *TableOptions) GetVerticalTimeAxis() bool

func (*TableOptions) GetWrapping

func (m *TableOptions) GetWrapping() string

func (*TableOptions) ProtoMessage

func (*TableOptions) ProtoMessage()

func (*TableOptions) Reset

func (m *TableOptions) Reset()

func (*TableOptions) String

func (m *TableOptions) String() string

type Template

type Template struct {
	ID      string           `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
	TempVar string           `protobuf:"bytes,2,opt,name=temp_var,json=tempVar,proto3" json:"temp_var,omitempty"`
	Values  []*TemplateValue `protobuf:"bytes,3,rep,name=values" json:"values,omitempty"`
	Type    string           `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"`
	Label   string           `protobuf:"bytes,5,opt,name=label,proto3" json:"label,omitempty"`
	Query   *TemplateQuery   `protobuf:"bytes,6,opt,name=query" json:"query,omitempty"`
}

func (*Template) Descriptor

func (*Template) Descriptor() ([]byte, []int)

func (*Template) GetID

func (m *Template) GetID() string

func (*Template) GetLabel

func (m *Template) GetLabel() string

func (*Template) GetQuery

func (m *Template) GetQuery() *TemplateQuery

func (*Template) GetTempVar

func (m *Template) GetTempVar() string

func (*Template) GetType

func (m *Template) GetType() string

func (*Template) GetValues

func (m *Template) GetValues() []*TemplateValue

func (*Template) ProtoMessage

func (*Template) ProtoMessage()

func (*Template) Reset

func (m *Template) Reset()

func (*Template) String

func (m *Template) String() string

type TemplateQuery

type TemplateQuery struct {
	Command     string `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"`
	Db          string `protobuf:"bytes,2,opt,name=db,proto3" json:"db,omitempty"`
	Rp          string `protobuf:"bytes,3,opt,name=rp,proto3" json:"rp,omitempty"`
	Measurement string `protobuf:"bytes,4,opt,name=measurement,proto3" json:"measurement,omitempty"`
	TagKey      string `protobuf:"bytes,5,opt,name=tag_key,json=tagKey,proto3" json:"tag_key,omitempty"`
	FieldKey    string `protobuf:"bytes,6,opt,name=field_key,json=fieldKey,proto3" json:"field_key,omitempty"`
}

func (*TemplateQuery) Descriptor

func (*TemplateQuery) Descriptor() ([]byte, []int)

func (*TemplateQuery) GetCommand

func (m *TemplateQuery) GetCommand() string

func (*TemplateQuery) GetDb

func (m *TemplateQuery) GetDb() string

func (*TemplateQuery) GetFieldKey

func (m *TemplateQuery) GetFieldKey() string

func (*TemplateQuery) GetMeasurement

func (m *TemplateQuery) GetMeasurement() string

func (*TemplateQuery) GetRp

func (m *TemplateQuery) GetRp() string

func (*TemplateQuery) GetTagKey

func (m *TemplateQuery) GetTagKey() string

func (*TemplateQuery) ProtoMessage

func (*TemplateQuery) ProtoMessage()

func (*TemplateQuery) Reset

func (m *TemplateQuery) Reset()

func (*TemplateQuery) String

func (m *TemplateQuery) String() string

type TemplateValue

type TemplateValue struct {
	Type     string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Value    string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	Selected bool   `protobuf:"varint,3,opt,name=selected,proto3" json:"selected,omitempty"`
}

func (*TemplateValue) Descriptor

func (*TemplateValue) Descriptor() ([]byte, []int)

func (*TemplateValue) GetSelected

func (m *TemplateValue) GetSelected() bool

func (*TemplateValue) GetType

func (m *TemplateValue) GetType() string

func (*TemplateValue) GetValue

func (m *TemplateValue) GetValue() string

func (*TemplateValue) ProtoMessage

func (*TemplateValue) ProtoMessage()

func (*TemplateValue) Reset

func (m *TemplateValue) Reset()

func (*TemplateValue) String

func (m *TemplateValue) String() string

type TimeShift

type TimeShift struct {
	Label    string `protobuf:"bytes,1,opt,name=Label,proto3" json:"Label,omitempty"`
	Unit     string `protobuf:"bytes,2,opt,name=Unit,proto3" json:"Unit,omitempty"`
	Quantity string `protobuf:"bytes,3,opt,name=Quantity,proto3" json:"Quantity,omitempty"`
}

func (*TimeShift) Descriptor

func (*TimeShift) Descriptor() ([]byte, []int)

func (*TimeShift) GetLabel

func (m *TimeShift) GetLabel() string

func (*TimeShift) GetQuantity

func (m *TimeShift) GetQuantity() string

func (*TimeShift) GetUnit

func (m *TimeShift) GetUnit() string

func (*TimeShift) ProtoMessage

func (*TimeShift) ProtoMessage()

func (*TimeShift) Reset

func (m *TimeShift) Reset()

func (*TimeShift) String

func (m *TimeShift) String() string

type User

type User struct {
	ID         uint64  `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Name       string  `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
	Provider   string  `protobuf:"bytes,3,opt,name=Provider,proto3" json:"Provider,omitempty"`
	Scheme     string  `protobuf:"bytes,4,opt,name=Scheme,proto3" json:"Scheme,omitempty"`
	Roles      []*Role `protobuf:"bytes,5,rep,name=Roles" json:"Roles,omitempty"`
	SuperAdmin bool    `protobuf:"varint,6,opt,name=SuperAdmin,proto3" json:"SuperAdmin,omitempty"`
}

func (*User) Descriptor

func (*User) Descriptor() ([]byte, []int)

func (*User) GetID

func (m *User) GetID() uint64

func (*User) GetName

func (m *User) GetName() string

func (*User) GetProvider

func (m *User) GetProvider() string

func (*User) GetRoles

func (m *User) GetRoles() []*Role

func (*User) GetScheme

func (m *User) GetScheme() string

func (*User) GetSuperAdmin

func (m *User) GetSuperAdmin() bool

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) Reset

func (m *User) Reset()

func (*User) String

func (m *User) String() string

type UsersStore

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

UsersStore uses bolt to store and retrieve users

func (*UsersStore) Add

Add a new User to the UsersStore.

func (*UsersStore) All

func (s *UsersStore) All(ctx context.Context) ([]chronograf.User, error)

All returns all users

func (*UsersStore) Delete

func (s *UsersStore) Delete(ctx context.Context, u *chronograf.User) error

Delete a user from the UsersStore

func (*UsersStore) Get

Get searches the UsersStore for user with name

func (*UsersStore) Num

func (s *UsersStore) Num(ctx context.Context) (int, error)

Num returns the number of users in the UsersStore

func (*UsersStore) Update

func (s *UsersStore) Update(ctx context.Context, u *chronograf.User) error

Update a user

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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