Documentation
¶
Index ¶
- Constants
- Variables
- type Bucket
- type Option
- type Service
- func (s *Service) Close() error
- func (s *Service) ConfigStore() chronograf.ConfigStore
- func (s *Service) DashboardsStore() chronograf.DashboardsStore
- func (s *Service) MappingsStore() chronograf.MappingsStore
- func (s *Service) OrganizationConfigStore() chronograf.OrganizationConfigStore
- func (s *Service) OrganizationsStore() chronograf.OrganizationsStore
- func (s *Service) ServersStore() chronograf.ServersStore
- func (s *Service) SourcesStore() chronograf.SourcesStore
- func (s *Service) UsersStore() chronograf.UsersStore
- type Store
- type Tx
Constants ¶
const ( // DefaultOrganizationName is the Name of the default organization DefaultOrganizationName string = "Default" // DefaultOrganizationRole is the DefaultRole for the Default organization DefaultOrganizationRole string = "member" )
Variables ¶
var ( // DefaultOrganizationID is the ID of the default organization. DefaultOrganizationID = []byte("default") )
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket interface {
// Get returns a key within this bucket. Errors if key does not exist.
Get(key []byte) ([]byte, error)
// Put should error if the transaction it was called in is not writable.
Put(key, value []byte) error
// Delete should error if the transaction it was called in is not writable.
Delete(key []byte) error
// NextSequence returns a unique id for the bucket.
NextSequence() (uint64, error)
// ForEach executes a function for each key/value pair in a bucket.
// If the provided function returns an error then the iteration is stopped and
// the error is returned to the caller. The provided function must not modify
// the bucket; this will result in undefined behavior.
ForEach(fn func(k, v []byte) error) error
}
Bucket is the abstraction used to perform get/put/delete/get-many operations in a key value store.
type Option ¶
Option to change behavior of Open()
func WithLogger ¶
func WithLogger(logger chronograf.Logger) Option
WithLogger allows setting the logger on the kv service.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the struct that chronograf services are implemented on.
func NewService ¶
NewService returns an instance of a Service.
func (*Service) ConfigStore ¶
func (s *Service) ConfigStore() chronograf.ConfigStore
ConfigStore returns a chronograf.ConfigStore.
func (*Service) DashboardsStore ¶
func (s *Service) DashboardsStore() chronograf.DashboardsStore
DashboardsStore returns a chronograf.DashboardsStore.
func (*Service) MappingsStore ¶
func (s *Service) MappingsStore() chronograf.MappingsStore
MappingsStore returns a chronograf.MappingsStore.
func (*Service) OrganizationConfigStore ¶
func (s *Service) OrganizationConfigStore() chronograf.OrganizationConfigStore
OrganizationConfigStore returns a chronograf.OrganizationConfigStore.
func (*Service) OrganizationsStore ¶
func (s *Service) OrganizationsStore() chronograf.OrganizationsStore
OrganizationsStore returns a chronograf.OrganizationsStore.
func (*Service) ServersStore ¶
func (s *Service) ServersStore() chronograf.ServersStore
ServersStore returns a chronograf.ServersStore.
func (*Service) SourcesStore ¶
func (s *Service) SourcesStore() chronograf.SourcesStore
SourcesStore returns a chronograf.SourcesStore.
func (*Service) UsersStore ¶
func (s *Service) UsersStore() chronograf.UsersStore
UsersStore returns a chronograf.UsersStore.
type Store ¶
type Store interface {
// View opens up a transaction that will not write to any data. Implementing interfaces
// should take care to ensure that all view transactions do not mutate any data.
View(context.Context, func(Tx) error) error
// Update opens up a transaction that will mutate data.
Update(context.Context, func(Tx) error) error
// Close closes the connection to the db.
Close() error
}
Store is an interface for a generic key value store. It is modeled after the boltdb database struct.
type Tx ¶
type Tx interface {
// Bucket creates and returns bucket, b.
Bucket(b []byte) Bucket
// CreateBucketIfNotExists creates a new bucket if it doesn't already exist.
// Returns an error if the bucket name is blank, or if the bucket name is too long.
// The bucket instance is only valid for the lifetime of the transaction.
CreateBucketIfNotExists(b []byte) (Bucket, error)
}
Tx is a transaction in the store.