Documentation ¶
Index ¶
- Constants
- type Bucket
- type KVStore
- type Service
- func (s *Service) AddDashboardCell(ctx context.Context, id platform.ID, cell *platform.Cell, ...) error
- func (s *Service) AddTarget(ctx context.Context, target *platform.ScraperTarget) (err error)
- func (s *Service) CompareAndSetPassword(ctx context.Context, name string, old string, new string) error
- func (s *Service) ComparePassword(ctx context.Context, name string, password string) error
- func (s *Service) Create(ctx context.Context, m *platform.DBRPMapping) error
- func (s *Service) CreateAuthorization(ctx context.Context, a *platform.Authorization) error
- func (s *Service) CreateBucket(ctx context.Context, b *platform.Bucket) error
- func (s *Service) CreateDashboard(ctx context.Context, d *platform.Dashboard) error
- func (s *Service) CreateLabel(ctx context.Context, l *platform.Label) error
- func (s *Service) CreateMacro(ctx context.Context, m *platform.Macro) error
- func (s *Service) CreateOrganization(ctx context.Context, o *platform.Organization) error
- func (s *Service) CreateTelegrafConfig(ctx context.Context, tc *platform.TelegrafConfig, userID platform.ID) error
- func (s *Service) CreateUser(ctx context.Context, u *platform.User) error
- func (s *Service) CreateUserResourceMapping(ctx context.Context, m *platform.UserResourceMapping) error
- func (s *Service) CreateView(ctx context.Context, c *platform.View) error
- func (s *Service) Delete(ctx context.Context, cluster, db, rp string) error
- func (s *Service) DeleteAuthorization(ctx context.Context, id platform.ID) error
- func (s *Service) DeleteBucket(ctx context.Context, id platform.ID) error
- func (s *Service) DeleteDashboard(ctx context.Context, id platform.ID) error
- func (s *Service) DeleteLabel(ctx context.Context, l platform.Label) error
- func (s *Service) DeleteMacro(ctx context.Context, id platform.ID) error
- func (s *Service) DeleteOrganization(ctx context.Context, id platform.ID) error
- func (s *Service) DeleteOrganizationBuckets(ctx context.Context, id platform.ID) error
- func (s *Service) DeleteTelegrafConfig(ctx context.Context, id platform.ID) error
- func (s *Service) DeleteUser(ctx context.Context, id platform.ID) error
- func (s *Service) DeleteUserResourceMapping(ctx context.Context, resourceID, userID platform.ID) error
- func (s *Service) DeleteView(ctx context.Context, id platform.ID) error
- func (s *Service) Find(ctx context.Context, filter platform.DBRPMappingFilter) (*platform.DBRPMapping, error)
- func (s *Service) FindAuthorizationByID(ctx context.Context, id platform.ID) (*platform.Authorization, error)
- func (s *Service) FindAuthorizationByToken(ctx context.Context, t string) (*platform.Authorization, error)
- func (s *Service) FindAuthorizations(ctx context.Context, filter platform.AuthorizationFilter, ...) ([]*platform.Authorization, int, error)
- func (s *Service) FindBucket(ctx context.Context, filter platform.BucketFilter) (*platform.Bucket, error)
- func (s *Service) FindBucketByID(ctx context.Context, id platform.ID) (*platform.Bucket, error)
- func (s *Service) FindBuckets(ctx context.Context, filter platform.BucketFilter, opt ...platform.FindOptions) ([]*platform.Bucket, int, error)
- func (s *Service) FindBy(ctx context.Context, cluster, db, rp string) (*platform.DBRPMapping, error)
- func (s *Service) FindDashboardByID(ctx context.Context, id platform.ID) (*platform.Dashboard, error)
- func (s *Service) FindDashboards(ctx context.Context, filter platform.DashboardFilter, ...) ([]*platform.Dashboard, int, error)
- func (s *Service) FindLabelBy(ctx context.Context, resourceID platform.ID, name string) (*platform.Label, error)
- func (s *Service) FindLabels(ctx context.Context, filter platform.LabelFilter, opt ...platform.FindOptions) ([]*platform.Label, error)
- func (s *Service) FindMacroByID(ctx context.Context, id platform.ID) (*platform.Macro, error)
- func (s *Service) FindMacros(ctx context.Context) ([]*platform.Macro, error)
- func (s *Service) FindMany(ctx context.Context, filter platform.DBRPMappingFilter, ...) ([]*platform.DBRPMapping, int, error)
- func (s *Service) FindOrganization(ctx context.Context, filter platform.OrganizationFilter) (*platform.Organization, error)
- func (s *Service) FindOrganizationByID(ctx context.Context, id platform.ID) (*platform.Organization, error)
- func (s *Service) FindOrganizations(ctx context.Context, filter platform.OrganizationFilter, ...) ([]*platform.Organization, int, error)
- func (s *Service) FindTelegrafConfig(ctx context.Context, filter platform.TelegrafConfigFilter) (*platform.TelegrafConfig, error)
- func (s *Service) FindTelegrafConfigByID(ctx context.Context, id platform.ID) (tc *platform.TelegrafConfig, err error)
- func (s *Service) FindTelegrafConfigs(ctx context.Context, filter platform.TelegrafConfigFilter, ...) (tcs []*platform.TelegrafConfig, n int, err error)
- func (s *Service) FindUser(ctx context.Context, filter platform.UserFilter) (*platform.User, error)
- func (s *Service) FindUserByID(ctx context.Context, id platform.ID) (u *platform.User, err error)
- func (s *Service) FindUserResourceBy(ctx context.Context, resourceID, userID platform.ID) (*platform.UserResourceMapping, error)
- func (s *Service) FindUserResourceMappings(ctx context.Context, filter platform.UserResourceMappingFilter, ...) ([]*platform.UserResourceMapping, int, error)
- func (s *Service) FindUsers(ctx context.Context, filter platform.UserFilter, opt ...platform.FindOptions) ([]*platform.User, int, error)
- func (s *Service) FindViewByID(ctx context.Context, id platform.ID) (*platform.View, error)
- func (s *Service) FindViews(ctx context.Context, filter platform.ViewFilter) ([]*platform.View, int, error)
- func (s *Service) Generate(ctx context.Context, req *platform.OnboardingRequest) (*platform.OnboardingResults, error)
- func (s *Service) GetDashboardCellView(ctx context.Context, dashboardID, cellID platform.ID) (*platform.View, error)
- func (s *Service) GetTargetByID(ctx context.Context, id platform.ID) (target *platform.ScraperTarget, err error)
- func (s *Service) IsOnboarding(ctx context.Context) (isOnboarding bool, err error)
- func (s *Service) ListTargets(ctx context.Context) (list []platform.ScraperTarget, err error)
- func (s *Service) Name(ctx context.Context, resource platform.Resource, id platform.ID) (string, error)
- func (s *Service) PutAuthorization(ctx context.Context, a *platform.Authorization) error
- func (s *Service) PutBucket(ctx context.Context, b *platform.Bucket) error
- func (s *Service) PutCellView(ctx context.Context, cell *platform.Cell) error
- func (s *Service) PutDBRPMapping(ctx context.Context, m *platform.DBRPMapping) error
- func (s *Service) PutDashboard(ctx context.Context, d *platform.Dashboard) error
- func (s *Service) PutDashboardCell(ctx context.Context, id platform.ID, cell *platform.Cell) error
- func (s *Service) PutDashboardWithMeta(ctx context.Context, d *platform.Dashboard) error
- func (s *Service) PutLabel(ctx context.Context, l *platform.Label) error
- func (s *Service) PutOnboardingStatus(ctx context.Context, v bool) error
- func (s *Service) PutOrganization(ctx context.Context, o *platform.Organization) error
- func (s *Service) PutTarget(ctx context.Context, target *platform.ScraperTarget) error
- func (s *Service) PutUser(ctx context.Context, o *platform.User) error
- func (s *Service) PutUserResourceMapping(ctx context.Context, m *platform.UserResourceMapping) error
- func (s *Service) PutView(ctx context.Context, c *platform.View) error
- func (s *Service) RemoveDashboardCell(ctx context.Context, dashboardID platform.ID, cellID platform.ID) error
- func (s *Service) RemoveTarget(ctx context.Context, id platform.ID) error
- func (s *Service) ReplaceDashboardCells(ctx context.Context, id platform.ID, cs []*platform.Cell) error
- func (s *Service) ReplaceMacro(ctx context.Context, m *platform.Macro) error
- func (s *Service) SetAuthorizationStatus(ctx context.Context, id platform.ID, status platform.Status) error
- func (s *Service) SetPassword(ctx context.Context, name string, password string) error
- func (s *Service) UpdateBucket(ctx context.Context, id platform.ID, upd platform.BucketUpdate) (*platform.Bucket, error)
- func (s *Service) UpdateDashboard(ctx context.Context, id platform.ID, upd platform.DashboardUpdate) (*platform.Dashboard, error)
- func (s *Service) UpdateDashboardCell(ctx context.Context, dashboardID platform.ID, cellID platform.ID, ...) (*platform.Cell, error)
- func (s *Service) UpdateDashboardCellView(ctx context.Context, dashboardID, cellID platform.ID, upd platform.ViewUpdate) (*platform.View, error)
- func (s *Service) UpdateLabel(ctx context.Context, l *platform.Label, upd platform.LabelUpdate) (*platform.Label, error)
- func (s *Service) UpdateMacro(ctx context.Context, id platform.ID, update *platform.MacroUpdate) (*platform.Macro, error)
- func (s *Service) UpdateOrganization(ctx context.Context, id platform.ID, upd platform.OrganizationUpdate) (*platform.Organization, error)
- func (s *Service) UpdateTarget(ctx context.Context, update *platform.ScraperTarget) (target *platform.ScraperTarget, err error)
- func (s *Service) UpdateTelegrafConfig(ctx context.Context, id platform.ID, tc *platform.TelegrafConfig, ...) (*platform.TelegrafConfig, error)
- func (s *Service) UpdateUser(ctx context.Context, id platform.ID, upd platform.UserUpdate) (*platform.User, error)
- func (s *Service) UpdateView(ctx context.Context, id platform.ID, upd platform.ViewUpdate) (*platform.View, error)
- func (s *Service) WithTime(fn func() time.Time)
- type Tx
Constants ¶
const HashCost = bcrypt.DefaultCost
HashCost is currently using bcrypt defaultCost
const OpPrefix = "inmem/"
OpPrefix is the op prefix.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket is a btree that implements kv.Bucket.
type KVStore ¶
type KVStore struct {
// contains filtered or unexported fields
}
KVStore is an in memory btree backed kv.Store.
type Service ¶
type Service struct { TokenGenerator platform.TokenGenerator IDGenerator platform.IDGenerator // contains filtered or unexported fields }
Service implements various top level services.
func (*Service) AddDashboardCell ¶
func (s *Service) AddDashboardCell(ctx context.Context, id platform.ID, cell *platform.Cell, opts platform.AddDashboardCellOptions) error
AddDashboardCell adds a new cell to the dashboard.
func (*Service) CompareAndSetPassword ¶
func (s *Service) CompareAndSetPassword(ctx context.Context, name string, old string, new string) error
CompareAndSetPassword replaces the old password with the new password if thee old password is correct.
func (*Service) ComparePassword ¶
ComparePassword compares a provided password with the stored password hash.
func (*Service) CreateAuthorization ¶
CreateAuthorization sets a.Token and a.ID and creates an platform.Authorization
func (*Service) CreateBucket ¶
CreateBucket creates a new bucket and sets b.ID with the new identifier.
func (*Service) CreateDashboard ¶
CreateDashboard implements platform.DashboardService interface.
func (*Service) CreateLabel ¶
func (*Service) CreateMacro ¶
CreateMacro implements the platform.MacroService interface
func (*Service) CreateOrganization ¶
CreateOrganization creates a new organization and sets b.ID with the new identifier.
func (*Service) CreateTelegrafConfig ¶
func (s *Service) CreateTelegrafConfig(ctx context.Context, tc *platform.TelegrafConfig, userID platform.ID) error
CreateTelegrafConfig creates a new telegraf config and sets b.ID with the new identifier.
func (*Service) CreateUser ¶
CreateUser will create an user into storage.
func (*Service) CreateUserResourceMapping ¶
func (*Service) CreateView ¶
CreateView implements platform.ViewService interface.
func (*Service) DeleteAuthorization ¶
DeleteAuthorization deletes an authorization associated with id.
func (*Service) DeleteBucket ¶
DeleteBucket removes a bucket by ID.
func (*Service) DeleteDashboard ¶
DeleteDashboard implements platform.DashboardService interface.
func (*Service) DeleteLabel ¶
func (*Service) DeleteMacro ¶
DeleteMacro implements the platform.MacroService interface
func (*Service) DeleteOrganization ¶
DeleteOrganization deletes a organization and prunes it from the index.
func (*Service) DeleteOrganizationBuckets ¶
DeleteOrganizationBuckets removes all the buckets for a given org
func (*Service) DeleteTelegrafConfig ¶
DeleteTelegrafConfig removes a telegraf config by ID.
func (*Service) DeleteUser ¶
DeleteUser remove a user from storage.
func (*Service) DeleteUserResourceMapping ¶
func (*Service) DeleteView ¶
DeleteView implements platform.ViewService interface.
func (*Service) Find ¶
func (s *Service) Find(ctx context.Context, filter platform.DBRPMappingFilter) (*platform.DBRPMapping, error)
Find returns the first dbrp mapping that matches filter.
func (*Service) FindAuthorizationByID ¶
func (s *Service) FindAuthorizationByID(ctx context.Context, id platform.ID) (*platform.Authorization, error)
FindAuthorizationByID returns an authorization given an ID.
func (*Service) FindAuthorizationByToken ¶
func (s *Service) FindAuthorizationByToken(ctx context.Context, t string) (*platform.Authorization, error)
FindAuthorizationByToken returns an authorization given a token.
func (*Service) FindAuthorizations ¶
func (s *Service) FindAuthorizations(ctx context.Context, filter platform.AuthorizationFilter, opt ...platform.FindOptions) ([]*platform.Authorization, int, error)
FindAuthorizations returns all authorizations matching the filter.
func (*Service) FindBucket ¶
func (s *Service) FindBucket(ctx context.Context, filter platform.BucketFilter) (*platform.Bucket, error)
FindBucket returns the first bucket that matches filter.
func (*Service) FindBucketByID ¶
FindBucketByID returns a single bucket by ID.
func (*Service) FindBuckets ¶
func (s *Service) FindBuckets(ctx context.Context, filter platform.BucketFilter, opt ...platform.FindOptions) ([]*platform.Bucket, int, error)
FindBuckets returns a list of buckets that match filter and the total count of matching buckets. Additional options provide pagination & sorting.
func (*Service) FindBy ¶
func (s *Service) FindBy(ctx context.Context, cluster, db, rp string) (*platform.DBRPMapping, error)
FindBy returns a single dbrp mapping by cluster, db and rp.
func (*Service) FindDashboardByID ¶
func (s *Service) FindDashboardByID(ctx context.Context, id platform.ID) (*platform.Dashboard, error)
FindDashboardByID returns a single dashboard by ID.
func (*Service) FindDashboards ¶
func (s *Service) FindDashboards(ctx context.Context, filter platform.DashboardFilter, opts platform.FindOptions) ([]*platform.Dashboard, int, error)
FindDashboards implements platform.DashboardService interface.
func (*Service) FindLabelBy ¶
func (*Service) FindLabels ¶
func (s *Service) FindLabels(ctx context.Context, filter platform.LabelFilter, opt ...platform.FindOptions) ([]*platform.Label, error)
func (*Service) FindMacroByID ¶
FindMacroByID implements the platform.MacroService interface
func (*Service) FindMacros ¶
FindMacros implements the platform.MacroService interface
func (*Service) FindMany ¶
func (s *Service) FindMany(ctx context.Context, filter platform.DBRPMappingFilter, opt ...platform.FindOptions) ([]*platform.DBRPMapping, int, error)
FindMany returns a list of dbrpMappings that match filter and the total count of matching dbrp mappings. Additional options provide pagination & sorting.
func (*Service) FindOrganization ¶
func (s *Service) FindOrganization(ctx context.Context, filter platform.OrganizationFilter) (*platform.Organization, error)
FindOrganization returns the first organization that matches a filter.
func (*Service) FindOrganizationByID ¶
func (s *Service) FindOrganizationByID(ctx context.Context, id platform.ID) (*platform.Organization, error)
FindOrganizationByID returns a single organization by ID.
func (*Service) FindOrganizations ¶
func (s *Service) FindOrganizations(ctx context.Context, filter platform.OrganizationFilter, opt ...platform.FindOptions) ([]*platform.Organization, int, error)
FindOrganizations returns a list of organizations that match filter and the total count of matching organizations.
func (*Service) FindTelegrafConfig ¶
func (s *Service) FindTelegrafConfig(ctx context.Context, filter platform.TelegrafConfigFilter) (*platform.TelegrafConfig, error)
FindTelegrafConfig returns the first telegraf config that matches filter.
func (*Service) FindTelegrafConfigByID ¶
func (s *Service) FindTelegrafConfigByID(ctx context.Context, id platform.ID) (tc *platform.TelegrafConfig, err error)
FindTelegrafConfigByID returns a single telegraf config by ID.
func (*Service) FindTelegrafConfigs ¶
func (s *Service) FindTelegrafConfigs(ctx context.Context, filter platform.TelegrafConfigFilter, opt ...platform.FindOptions) (tcs []*platform.TelegrafConfig, n int, err error)
FindTelegrafConfigs returns a list of telegraf configs that match filter and the total count of matching telegraf configs. Additional options provide pagination & sorting.
func (*Service) FindUserByID ¶
FindUserByID returns a single user by ID.
func (*Service) FindUserResourceBy ¶
func (*Service) FindUserResourceMappings ¶
func (s *Service) FindUserResourceMappings(ctx context.Context, filter platform.UserResourceMappingFilter, opt ...platform.FindOptions) ([]*platform.UserResourceMapping, int, error)
func (*Service) FindUsers ¶
func (s *Service) FindUsers(ctx context.Context, filter platform.UserFilter, opt ...platform.FindOptions) ([]*platform.User, int, error)
FindUsers will retrieve a list of users from storage.
func (*Service) FindViewByID ¶
FindViewByID returns a single view by ID.
func (*Service) FindViews ¶
func (s *Service) FindViews(ctx context.Context, filter platform.ViewFilter) ([]*platform.View, int, error)
FindViews implements platform.ViewService interface.
func (*Service) Generate ¶
func (s *Service) Generate(ctx context.Context, req *platform.OnboardingRequest) (*platform.OnboardingResults, error)
Generate OnboardingResults from onboarding request, update storage so this request will be disabled for the second run.
func (*Service) GetDashboardCellView ¶
func (s *Service) GetDashboardCellView(ctx context.Context, dashboardID, cellID platform.ID) (*platform.View, error)
GetDashboardCellView retrieves the view for a dashboard cell.
func (*Service) GetTargetByID ¶
func (s *Service) GetTargetByID(ctx context.Context, id platform.ID) (target *platform.ScraperTarget, err error)
GetTargetByID retrieves a scraper target by id.
func (*Service) IsOnboarding ¶
IsOnboarding checks onboardingBucket to see if the onboarding key is true.
func (*Service) ListTargets ¶
ListTargets will list all scrape targets.
func (*Service) Name ¶
func (s *Service) Name(ctx context.Context, resource platform.Resource, id platform.ID) (string, error)
Name returns the name for the resource and ID.
func (*Service) PutAuthorization ¶
PutAuthorization overwrites the authorization with the contents of a.
func (*Service) PutCellView ¶
PutCellView puts the view for a cell.
func (*Service) PutDBRPMapping ¶
PutDBRPMapping sets dbrpMapping with the current ID.
func (*Service) PutDashboard ¶
PutDashboard implements platform.DashboardService interface.
func (*Service) PutDashboardCell ¶
PutDashboardCell replaces a dashboad cell with the cell contents.
func (*Service) PutDashboardWithMeta ¶
PutDashboardWithMeta sets a dashboard while updating the meta field of a dashboard.
func (*Service) PutOnboardingStatus ¶
PutOnboardingStatus will put the isOnboarding to storage
func (*Service) PutOrganization ¶
PutOrganization will put a organization without setting an ID.
func (*Service) PutUserResourceMapping ¶
func (*Service) RemoveDashboardCell ¶
func (s *Service) RemoveDashboardCell(ctx context.Context, dashboardID platform.ID, cellID platform.ID) error
RemoveDashboardCell removes a dashboard cell from the dashboard.
func (*Service) RemoveTarget ¶
RemoveTarget removes a scraper target from the bucket.
func (*Service) ReplaceDashboardCells ¶
func (s *Service) ReplaceDashboardCells(ctx context.Context, id platform.ID, cs []*platform.Cell) error
ReplaceDashboardCells replaces many dashboard cells.
func (*Service) ReplaceMacro ¶
ReplaceMacro stores a Macro in the key value store
func (*Service) SetAuthorizationStatus ¶
func (s *Service) SetAuthorizationStatus(ctx context.Context, id platform.ID, status platform.Status) error
SetAuthorizationStatus updates the status of an authorization associated with id.
func (*Service) SetPassword ¶
SetPassword stores the password hash associated with a user.
func (*Service) UpdateBucket ¶
func (s *Service) UpdateBucket(ctx context.Context, id platform.ID, upd platform.BucketUpdate) (*platform.Bucket, error)
UpdateBucket updates a single bucket with changeset. Returns the new bucket state after update.
func (*Service) UpdateDashboard ¶
func (s *Service) UpdateDashboard(ctx context.Context, id platform.ID, upd platform.DashboardUpdate) (*platform.Dashboard, error)
UpdateDashboard implements platform.DashboardService interface.
func (*Service) UpdateDashboardCell ¶
func (s *Service) UpdateDashboardCell(ctx context.Context, dashboardID platform.ID, cellID platform.ID, upd platform.CellUpdate) (*platform.Cell, error)
UpdateDashboardCell will remove a cell from a dashboard.
func (*Service) UpdateDashboardCellView ¶
func (s *Service) UpdateDashboardCellView(ctx context.Context, dashboardID, cellID platform.ID, upd platform.ViewUpdate) (*platform.View, error)
UpdateDashboardCellView updates the view for a dashboard cell.
func (*Service) UpdateLabel ¶
func (*Service) UpdateMacro ¶
func (s *Service) UpdateMacro(ctx context.Context, id platform.ID, update *platform.MacroUpdate) (*platform.Macro, error)
UpdateMacro implements the platform.MacroService interface
func (*Service) UpdateOrganization ¶
func (s *Service) UpdateOrganization(ctx context.Context, id platform.ID, upd platform.OrganizationUpdate) (*platform.Organization, error)
UpdateOrganization updates a organization according the parameters set on upd.
func (*Service) UpdateTarget ¶
func (s *Service) UpdateTarget(ctx context.Context, update *platform.ScraperTarget) (target *platform.ScraperTarget, err error)
UpdateTarget updates a scraper target.
func (*Service) UpdateTelegrafConfig ¶
func (s *Service) UpdateTelegrafConfig(ctx context.Context, id platform.ID, tc *platform.TelegrafConfig, userID platform.ID) (*platform.TelegrafConfig, error)
UpdateTelegrafConfig updates a single telegraf config. Returns the new telegraf config after update.
func (*Service) UpdateUser ¶
func (s *Service) UpdateUser(ctx context.Context, id platform.ID, upd platform.UserUpdate) (*platform.User, error)
UpdateUser update a user in storage.
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx is an in memory transaction. TODO: make transactions actually transactional
func (*Tx) WithContext ¶
WithContext sets the context for the transaction.