bolt

package
v0.0.0-...-f5b6858 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ErrUnableToOpen means we had an issue establishing a connection (or creating the database)
	ErrUnableToOpen = "Unable to open boltdb; is there a chronograf already running?  %v"
	// ErrUnableToBackup means we couldn't copy the db file into ./backup
	ErrUnableToBackup = "Unable to backup your database prior to migrations:  %v"
	// ErrUnableToInitialize means we couldn't create missing Buckets (maybe a timeout)
	ErrUnableToInitialize = "Unable to boot boltdb:  %v"
	// ErrUnableToMigrate means we had an issue changing the db schema
	ErrUnableToMigrate = "Unable to migrate boltdb:  %v"
)

Variables

View Source
var DefaultSource = platform.Source{
	Default: true,
	Name:    "autogen",
	Type:    platform.SelfSourceType,
}

DefaultSource is the default source.

Functions

This section is empty.

Types

type Client

type Client struct {
	Path string

	Logger *zap.Logger

	IDGenerator    platform.IDGenerator
	TokenGenerator platform.TokenGenerator
	// contains filtered or unexported fields
}

Client is a client for the boltDB data store.

func NewClient

func NewClient() *Client

NewClient returns an instance of a Client.

func (*Client) AddDashboardCell

func (c *Client) AddDashboardCell(ctx context.Context, id platform.ID, cell *platform.Cell, opts platform.AddDashboardCellOptions) error

AddDashboardCell adds a cell to a dashboard and sets the cells ID.

func (*Client) Close

func (c *Client) Close() error

Close the connection to the bolt database

func (*Client) CreateAuthorization

func (c *Client) CreateAuthorization(ctx context.Context, a *platform.Authorization) error

CreateAuthorization creates a platform authorization and sets b.ID, and b.UserID if not provided.

func (*Client) CreateBucket

func (c *Client) CreateBucket(ctx context.Context, b *platform.Bucket) error

CreateBucket creates a platform bucket and sets b.ID.

func (*Client) CreateDashboard

func (c *Client) CreateDashboard(ctx context.Context, d *platform.Dashboard) error

CreateDashboard creates a platform dashboard and sets d.ID.

func (*Client) CreateOrganization

func (c *Client) CreateOrganization(ctx context.Context, o *platform.Organization) error

CreateOrganization creates a platform organization and sets b.ID.

func (*Client) CreateSource

func (c *Client) CreateSource(ctx context.Context, s *platform.Source) error

CreateSource creates a platform source and sets s.ID.

func (*Client) CreateUser

func (c *Client) CreateUser(ctx context.Context, u *platform.User) error

CreateUser creates a platform user and sets b.ID.

func (*Client) CreateView

func (c *Client) CreateView(ctx context.Context, d *platform.View) error

CreateView creates a platform view and sets d.ID.

func (*Client) DB

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

DB returns the clients DB.

func (*Client) DefaultSource

func (c *Client) DefaultSource(ctx context.Context) (*platform.Source, error)

DefaultSource retrieves the default source.

func (*Client) DeleteAuthorization

func (c *Client) DeleteAuthorization(ctx context.Context, id platform.ID) error

DeleteAuthorization deletes a authorization and prunes it from the index.

func (*Client) DeleteBucket

func (c *Client) DeleteBucket(ctx context.Context, id platform.ID) error

DeleteBucket deletes a bucket and prunes it from the index.

func (*Client) DeleteDashboard

func (c *Client) DeleteDashboard(ctx context.Context, id platform.ID) error

DeleteDashboard deletes a dashboard and prunes it from the index.

func (*Client) DeleteOrganization

func (c *Client) DeleteOrganization(ctx context.Context, id platform.ID) error

DeleteOrganization deletes a organization and prunes it from the index.

func (*Client) DeleteSource

func (c *Client) DeleteSource(ctx context.Context, id platform.ID) error

DeleteSource deletes a source and prunes it from the index.

func (*Client) DeleteUser

func (c *Client) DeleteUser(ctx context.Context, id platform.ID) error

DeleteUser deletes a user and prunes it from the index.

func (*Client) DeleteView

func (c *Client) DeleteView(ctx context.Context, id platform.ID) error

DeleteView deletes a view and prunes it from the index.

func (*Client) FindAuthorizationByID

func (c *Client) FindAuthorizationByID(ctx context.Context, id platform.ID) (*platform.Authorization, error)

FindAuthorizationByID retrieves a authorization by id.

func (*Client) FindAuthorizationByToken

func (c *Client) FindAuthorizationByToken(ctx context.Context, n string) (*platform.Authorization, error)

FindAuthorizationByToken returns a authorization by token for a particular authorization.

func (*Client) FindAuthorizations

func (c *Client) FindAuthorizations(ctx context.Context, filter platform.AuthorizationFilter, opt ...platform.FindOptions) ([]*platform.Authorization, int, error)

FindAuthorizations retrives all authorizations that match an arbitrary authorization filter. Filters using ID, or Token should be efficient. Other filters will do a linear scan across all authorizations searching for a match.

func (*Client) FindBucket

func (c *Client) FindBucket(ctx context.Context, filter platform.BucketFilter) (*platform.Bucket, error)

FindBucket retrives a bucket using an arbitrary bucket filter. Filters using ID, or OrganizationID and bucket Name should be efficient. Other filters will do a linear scan across buckets until it finds a match.

func (*Client) FindBucketByID

func (c *Client) FindBucketByID(ctx context.Context, id platform.ID) (*platform.Bucket, error)

FindBucketByID retrieves a bucket by id.

func (*Client) FindBucketByName

func (c *Client) FindBucketByName(ctx context.Context, orgID platform.ID, n string) (*platform.Bucket, error)

FindBucketByName returns a bucket by name for a particular organization. TODO: have method for finding bucket using organization name and bucket name.

func (*Client) FindBuckets

func (c *Client) FindBuckets(ctx context.Context, filter platform.BucketFilter, opt ...platform.FindOptions) ([]*platform.Bucket, int, error)

FindBuckets retrives all buckets that match an arbitrary bucket filter. Filters using ID, or OrganizationID and bucket Name should be efficient. Other filters will do a linear scan across all buckets searching for a match.

func (*Client) FindDashboard

func (c *Client) FindDashboard(ctx context.Context, filter platform.DashboardFilter) (*platform.Dashboard, error)

FindDashboard retrieves a dashboard using an arbitrary dashboard filter.

func (*Client) FindDashboardByID

func (c *Client) FindDashboardByID(ctx context.Context, id platform.ID) (*platform.Dashboard, error)

FindDashboardByID retrieves a dashboard by id.

func (*Client) FindDashboards

func (c *Client) FindDashboards(ctx context.Context, filter platform.DashboardFilter) ([]*platform.Dashboard, int, error)

FindDashboards retrives all dashboards that match an arbitrary dashboard filter.

func (*Client) FindOrganization

func (c *Client) FindOrganization(ctx context.Context, filter platform.OrganizationFilter) (*platform.Organization, error)

FindOrganization retrives a organization using an arbitrary organization filter. Filters using ID, or Name should be efficient. Other filters will do a linear scan across organizations until it finds a match.

func (*Client) FindOrganizationByID

func (c *Client) FindOrganizationByID(ctx context.Context, id platform.ID) (*platform.Organization, error)

FindOrganizationByID retrieves a organization by id.

func (*Client) FindOrganizationByName

func (c *Client) FindOrganizationByName(ctx context.Context, n string) (*platform.Organization, error)

FindOrganizationByName returns a organization by name for a particular organization.

func (*Client) FindOrganizations

func (c *Client) FindOrganizations(ctx context.Context, filter platform.OrganizationFilter, opt ...platform.FindOptions) ([]*platform.Organization, int, error)

FindOrganizations retrives all organizations that match an arbitrary organization filter. Filters using ID, or Name should be efficient. Other filters will do a linear scan across all organizations searching for a match.

func (*Client) FindSourceByID

func (c *Client) FindSourceByID(ctx context.Context, id platform.ID) (*platform.Source, error)

FindSourceByID retrieves a source by id.

func (*Client) FindSources

func (c *Client) FindSources(ctx context.Context, opt platform.FindOptions) ([]*platform.Source, int, error)

FindSources retrives all sources that match an arbitrary source filter. Filters using ID, or OrganizationID and source Name should be efficient. Other filters will do a linear scan across all sources searching for a match.

func (*Client) FindUser

func (c *Client) FindUser(ctx context.Context, filter platform.UserFilter) (*platform.User, error)

FindUser retrives a user using an arbitrary user filter. Filters using ID, or Name should be efficient. Other filters will do a linear scan across users until it finds a match.

func (*Client) FindUserByID

func (c *Client) FindUserByID(ctx context.Context, id platform.ID) (*platform.User, error)

FindUserByID retrieves a user by id.

func (*Client) FindUserByName

func (c *Client) FindUserByName(ctx context.Context, n string) (*platform.User, error)

FindUserByName returns a user by name for a particular user.

func (*Client) FindUsers

func (c *Client) FindUsers(ctx context.Context, filter platform.UserFilter, opt ...platform.FindOptions) ([]*platform.User, int, error)

FindUsers retrives all users that match an arbitrary user filter. Filters using ID, or Name should be efficient. Other filters will do a linear scan across all users searching for a match.

func (*Client) FindView

func (c *Client) FindView(ctx context.Context, filter platform.ViewFilter) (*platform.View, error)

FindView retrieves a view using an arbitrary view filter.

func (*Client) FindViewByID

func (c *Client) FindViewByID(ctx context.Context, id platform.ID) (*platform.View, error)

FindViewByID retrieves a view by id.

func (*Client) FindViews

func (c *Client) FindViews(ctx context.Context, filter platform.ViewFilter) ([]*platform.View, int, error)

FindViews retrives all views that match an arbitrary view filter.

func (*Client) Open

func (c *Client) Open(ctx context.Context) error

Open / create boltDB file.

func (*Client) PutAuthorization

func (c *Client) PutAuthorization(ctx context.Context, a *platform.Authorization) error

PutAuthorization will put a authorization without setting an ID.

func (*Client) PutBucket

func (c *Client) PutBucket(ctx context.Context, b *platform.Bucket) error

PutBucket will put a bucket without setting an ID.

func (*Client) PutDashboard

func (c *Client) PutDashboard(ctx context.Context, d *platform.Dashboard) error

PutDashboard will put a dashboard without setting an ID.

func (*Client) PutOrganization

func (c *Client) PutOrganization(ctx context.Context, o *platform.Organization) error

PutOrganization will put a organization without setting an ID.

func (*Client) PutSource

func (c *Client) PutSource(ctx context.Context, s *platform.Source) error

PutSource will put a source without setting an ID.

func (*Client) PutUser

func (c *Client) PutUser(ctx context.Context, u *platform.User) error

PutUser will put a user without setting an ID.

func (*Client) PutView

func (c *Client) PutView(ctx context.Context, d *platform.View) error

PutView will put a view without setting an ID.

func (*Client) RemoveDashboardCell

func (c *Client) RemoveDashboardCell(ctx context.Context, dashboardID, cellID platform.ID) error

RemoveDashboardCell removes a cell from a dashboard.

func (*Client) ReplaceDashboardCells

func (c *Client) ReplaceDashboardCells(ctx context.Context, id platform.ID, cs []*platform.Cell) error

ReplaceDashboardCells creates a platform dashboard and sets d.ID.

func (*Client) SetAuthorizationStatus

func (c *Client) SetAuthorizationStatus(ctx context.Context, id platform.ID, status platform.Status) error

SetAuthorizationStatus updates the status of the authorization. Useful for setting an authorization to inactive or active.

func (*Client) UpdateBucket

func (c *Client) UpdateBucket(ctx context.Context, id platform.ID, upd platform.BucketUpdate) (*platform.Bucket, error)

UpdateBucket updates a bucket according the parameters set on upd.

func (*Client) UpdateDashboard

func (c *Client) UpdateDashboard(ctx context.Context, id platform.ID, upd platform.DashboardUpdate) (*platform.Dashboard, error)

UpdateDashboard updates a dashboard according the parameters set on upd.

func (*Client) UpdateDashboardCell

func (c *Client) UpdateDashboardCell(ctx context.Context, dashboardID, cellID platform.ID, upd platform.CellUpdate) (*platform.Cell, error)

UpdateDashboardCell udpates a cell on a dashboard.

func (*Client) UpdateOrganization

func (c *Client) UpdateOrganization(ctx context.Context, id platform.ID, upd platform.OrganizationUpdate) (*platform.Organization, error)

UpdateOrganization updates a organization according the parameters set on upd.

func (*Client) UpdateSource

func (c *Client) UpdateSource(ctx context.Context, id platform.ID, upd platform.SourceUpdate) (*platform.Source, error)

UpdateSource updates a source according the parameters set on upd.

func (*Client) UpdateUser

func (c *Client) UpdateUser(ctx context.Context, id platform.ID, upd platform.UserUpdate) (*platform.User, error)

UpdateUser updates a user according the parameters set on upd.

func (*Client) UpdateView

func (c *Client) UpdateView(ctx context.Context, id platform.ID, upd platform.ViewUpdate) (*platform.View, error)

UpdateView updates a view according the parameters set on upd.

func (*Client) WithLogger

func (c *Client) WithLogger(l *zap.Logger)

WithLogger sets the logger an a client. It should not be called after the client has been open.

Jump to

Keyboard shortcuts

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