Documentation ¶
Index ¶
- Constants
- Variables
- func BucketAlreadyExistsError(b *influxdb.Bucket) error
- func CorruptScraperError(err error) *influxdb.Error
- func CorruptTelegrafError(err error) *influxdb.Error
- func CorruptURMError(err error) *influxdb.Error
- func CorruptUserIDError(userID string, err error) *influxdb.Error
- func DecIndexID(key, val []byte) ([]byte, interface{}, error)
- func DecodeOrgNameKey(k []byte) (influxdb.ID, string, error)
- func EncBodyJSON(ent Entity) ([]byte, string, error)
- func EncIDKey(ent Entity) ([]byte, string, error)
- func EncUniqKey(ent Entity) ([]byte, string, error)
- func ErrCorruptUser(err error) *influxdb.Error
- func ErrCorruptUserID(err error) *influxdb.Error
- func ErrInternalUserServiceError(err error) *influxdb.Error
- func ErrUnprocessableMapping(err error) *influxdb.Error
- func ErrUnprocessableScraper(err error) *influxdb.Error
- func ErrUnprocessableTelegraf(err error) *influxdb.Error
- func ErrUnprocessableUser(err error) *influxdb.Error
- func InternalNotificationRuleStoreError(err error) *influxdb.Error
- func InternalPasswordHashError(err error) *influxdb.Error
- func InternalScraperServiceError(err error) *influxdb.Error
- func InternalTelegrafServiceError(err error) *influxdb.Error
- func InvalidUserIDError(err error) *influxdb.Error
- func IsErrUnexpectedDecodeVal(ok bool) error
- func IsNotFound(err error) bool
- func MarshalUser(u *influxdb.User) ([]byte, error)
- func NonUniqueMappingError(userID influxdb.ID) error
- func OrgAlreadyExistsError(o *influxdb.Organization) error
- func UnavailableNotificationRuleStoreError(err error) *influxdb.Error
- func UnavailablePasswordServiceError(err error) *influxdb.Error
- func UnavailableTelegrafServiceError(err error) *influxdb.Error
- func UnavailableURMServiceError(err error) *influxdb.Error
- func UnexpectedAuthIndexError(err error) *influxdb.Error
- func UnexpectedBucketError(err error) *influxdb.Error
- func UnexpectedBucketIndexError(err error) *influxdb.Error
- func UnexpectedIndexError(err error) *influxdb.Error
- func UnexpectedScrapersBucketError(err error) *influxdb.Error
- func UnexpectedUserBucketError(err error) *influxdb.Error
- func UnexpectedUserIndexError(err error) *influxdb.Error
- func UnmarshalUser(v []byte) (*influxdb.User, error)
- func UserAlreadyExistsError(n string) *influxdb.Error
- func WalkCursor(ctx context.Context, cursor ForwardCursor, visit VisitFunc) (err error)
- func WithIndexReadPathEnabled(i *Index)
- func WithPopulateRemoveDanglingForeignKeys(c *PopulateConfig)
- type AnonymousMigration
- type AutoMigrationStore
- type Bcrypt
- type Bucket
- type ConvertValToEntFn
- type Crypt
- type Cursor
- type CursorConfig
- type CursorDirection
- type CursorHint
- type CursorHints
- type CursorOption
- type CursorPredicateFunc
- type DecodeBucketValFn
- type DeleteOpts
- type DeleteRelationsFn
- type DocumentDecorator
- type DocumentIndex
- func (i *DocumentIndex) FindLabelByID(id influxdb.ID) error
- func (i *DocumentIndex) FindOrganizationByID(id influxdb.ID) error
- func (i *DocumentIndex) FindOrganizationByName(org string) (influxdb.ID, error)
- func (i *DocumentIndex) GetAccessorsDocuments(ownerType string, ownerID influxdb.ID) ([]influxdb.ID, error)
- func (i *DocumentIndex) GetDocumentsAccessors(docID influxdb.ID) ([]influxdb.ID, error)
- func (i *DocumentIndex) IsOrgAccessor(userID influxdb.ID, orgID influxdb.ID) error
- func (i *DocumentIndex) UsersOrgs(userID influxdb.ID) ([]influxdb.ID, error)
- type DocumentStore
- func (s *DocumentStore) CreateDocument(ctx context.Context, d *influxdb.Document) error
- func (s *DocumentStore) DeleteDocument(ctx context.Context, id influxdb.ID) error
- func (s *DocumentStore) DeleteDocuments(ctx context.Context, opts ...influxdb.DocumentFindOptions) error
- func (s *DocumentStore) FindDocument(ctx context.Context, id influxdb.ID) (*influxdb.Document, error)
- func (s *DocumentStore) FindDocuments(ctx context.Context, opts ...influxdb.DocumentFindOptions) ([]*influxdb.Document, error)
- func (s *DocumentStore) PutDocument(ctx context.Context, d *influxdb.Document) error
- func (s *DocumentStore) UpdateDocument(ctx context.Context, d *influxdb.Document) error
- type EncodeEntFn
- type EncodeFn
- type Entity
- type FilterFn
- type FindCaptureFn
- type FindOpts
- type ForwardCursor
- type Index
- func (i *Index) Delete(tx Tx, foreignKey, primaryKey []byte) error
- func (i *Index) DeleteAll(ctx context.Context, store Store) error
- func (i *Index) Insert(tx Tx, foreignKey, primaryKey []byte) error
- func (i *Index) Migration(opts ...PopulateOption) *IndexMigration
- func (i *Index) Populate(ctx context.Context, store Store, opts ...PopulateOption) (n int, err error)
- func (i *Index) Verify(ctx context.Context, store Store) (diff IndexDiff, err error)
- func (i *Index) Walk(ctx context.Context, tx Tx, foreignKey []byte, visitFn VisitFunc) error
- type IndexDiff
- type IndexMapping
- type IndexMigration
- type IndexOption
- type IndexSourceOnFunc
- type IndexStore
- func (s *IndexStore) Delete(ctx context.Context, tx Tx, opts DeleteOpts) error
- func (s *IndexStore) DeleteEnt(ctx context.Context, tx Tx, ent Entity) error
- func (s *IndexStore) Find(ctx context.Context, tx Tx, opts FindOpts) error
- func (s *IndexStore) FindEnt(ctx context.Context, tx Tx, ent Entity) (interface{}, error)
- func (s *IndexStore) Init(ctx context.Context, tx Tx) error
- func (s *IndexStore) Put(ctx context.Context, tx Tx, ent Entity, opts ...PutOptionFn) error
- type Migration
- type MigrationFunc
- type MigrationSpec
- type MigrationState
- type Migrator
- func (m *Migrator) AddMigrations(ms ...MigrationSpec)
- func (m *Migrator) Down(ctx context.Context, store Store) (err error)
- func (m *Migrator) Initialize(ctx context.Context, store Store) error
- func (m *Migrator) List(ctx context.Context, store Store) (migrations []Migration, _ error)
- func (m *Migrator) Up(ctx context.Context, store Store) error
- type Pair
- type PopulateConfig
- type PopulateOption
- type PutOptionFn
- type Service
- func (s *Service) AddDashboardCell(ctx context.Context, id influxdb.ID, cell *influxdb.Cell, ...) error
- func (s *Service) AddLogEntry(ctx context.Context, k, v []byte, t time.Time) error
- func (s *Service) AddRunLog(ctx context.Context, taskID, runID influxdb.ID, when time.Time, log string) error
- func (s *Service) AddTarget(ctx context.Context, target *influxdb.ScraperTarget, userID influxdb.ID) (err error)
- func (s *Service) Backup(ctx context.Context, w io.Writer) error
- func (s *Service) CancelRun(ctx context.Context, taskID, runID influxdb.ID) error
- func (s *Service) CompareAndSetPassword(ctx context.Context, userID influxdb.ID, old string, new string) error
- func (s *Service) ComparePassword(ctx context.Context, userID influxdb.ID, password string) error
- func (s *Service) CreateAuthorization(ctx context.Context, a *influxdb.Authorization) error
- func (s *Service) CreateAuthorizationTx(ctx context.Context, tx Tx, a *influxdb.Authorization) error
- func (s *Service) CreateBucket(ctx context.Context, b *influxdb.Bucket) error
- func (s *Service) CreateBucketTx(ctx context.Context, tx Tx, b *influxdb.Bucket) (err error)
- func (s *Service) CreateCheck(ctx context.Context, c influxdb.CheckCreate, userID influxdb.ID) error
- func (s *Service) CreateDashboard(ctx context.Context, d *influxdb.Dashboard) error
- func (s *Service) CreateDocumentStore(ctx context.Context, ns string) (influxdb.DocumentStore, error)
- func (s *Service) CreateLabel(ctx context.Context, l *influxdb.Label) error
- func (s *Service) CreateLabelMapping(ctx context.Context, m *influxdb.LabelMapping) error
- func (s *Service) CreateNotificationEndpoint(ctx context.Context, edp influxdb.NotificationEndpoint, userID influxdb.ID) error
- func (s *Service) CreateNotificationRule(ctx context.Context, nr influxdb.NotificationRuleCreate, userID influxdb.ID) error
- func (s *Service) CreateOrganization(ctx context.Context, o *influxdb.Organization) error
- func (s *Service) CreateOrganizationTx(ctx context.Context, tx Tx, o *influxdb.Organization) (err error)
- func (s *Service) CreateRun(ctx context.Context, taskID influxdb.ID, scheduledFor time.Time, ...) (*influxdb.Run, error)
- func (s *Service) CreateSession(ctx context.Context, user string) (*influxdb.Session, error)
- func (s *Service) CreateSource(ctx context.Context, src *influxdb.Source) error
- func (s *Service) CreateSystemBuckets(ctx context.Context, o *influxdb.Organization) error
- func (s *Service) CreateTask(ctx context.Context, tc influxdb.TaskCreate) (*influxdb.Task, error)
- func (s *Service) CreateTelegrafConfig(ctx context.Context, tc *influxdb.TelegrafConfig, userID influxdb.ID) error
- func (s *Service) CreateUser(ctx context.Context, u *influxdb.User) error
- func (s *Service) CreateUserResourceMapping(ctx context.Context, m *influxdb.UserResourceMapping) error
- func (s *Service) CreateUserResourceMappingForOrg(ctx context.Context, tx Tx, orgID influxdb.ID, resID influxdb.ID, ...) error
- func (s *Service) CreateUserResourceMappingTx(ctx context.Context, tx Tx, m *influxdb.UserResourceMapping) error
- func (s *Service) CreateUserTx(ctx context.Context, tx Tx, u *influxdb.User) error
- func (s *Service) CreateVariable(ctx context.Context, v *influxdb.Variable) error
- func (s *Service) CurrentlyRunning(ctx context.Context, taskID influxdb.ID) ([]*influxdb.Run, error)
- func (s *Service) DefaultSource(ctx context.Context) (*influxdb.Source, error)
- func (s *Service) DeleteAuthorization(ctx context.Context, id influxdb.ID) error
- func (s *Service) DeleteBucket(ctx context.Context, id influxdb.ID) error
- func (s *Service) DeleteCheck(ctx context.Context, id influxdb.ID) error
- func (s *Service) DeleteDashboard(ctx context.Context, id influxdb.ID) error
- func (s *Service) DeleteLabel(ctx context.Context, id influxdb.ID) error
- func (s *Service) DeleteLabelMapping(ctx context.Context, m *influxdb.LabelMapping) error
- func (s *Service) DeleteNotificationEndpoint(ctx context.Context, id influxdb.ID) (flds []influxdb.SecretField, orgID influxdb.ID, err error)
- func (s *Service) DeleteNotificationRule(ctx context.Context, id influxdb.ID) error
- func (s *Service) DeleteOrganization(ctx context.Context, id influxdb.ID) error
- func (s *Service) DeleteSecret(ctx context.Context, orgID influxdb.ID, ks ...string) error
- func (s *Service) DeleteSource(ctx context.Context, id influxdb.ID) error
- func (s *Service) DeleteTask(ctx context.Context, id influxdb.ID) error
- func (s *Service) DeleteTelegrafConfig(ctx context.Context, id influxdb.ID) error
- func (s *Service) DeleteUser(ctx context.Context, id influxdb.ID) error
- func (s *Service) DeleteUserResourceMapping(ctx context.Context, resourceID influxdb.ID, userID influxdb.ID) error
- func (s *Service) DeleteVariable(ctx context.Context, id influxdb.ID) error
- func (s *Service) ExpireSession(ctx context.Context, key string) error
- func (s *Service) FindAuthorizationByID(ctx context.Context, id influxdb.ID) (*influxdb.Authorization, error)
- func (s *Service) FindAuthorizationByToken(ctx context.Context, n string) (*influxdb.Authorization, error)
- func (s *Service) FindAuthorizations(ctx context.Context, filter influxdb.AuthorizationFilter, ...) ([]*influxdb.Authorization, int, error)
- func (s *Service) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.Bucket, error)
- func (s *Service) FindBucketByID(ctx context.Context, id influxdb.ID) (*influxdb.Bucket, error)
- func (s *Service) FindBucketByName(ctx context.Context, orgID influxdb.ID, n string) (*influxdb.Bucket, error)
- func (s *Service) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, ...) ([]*influxdb.Bucket, int, error)
- func (s *Service) FindCheck(ctx context.Context, filter influxdb.CheckFilter) (influxdb.Check, error)
- func (s *Service) FindCheckByID(ctx context.Context, id influxdb.ID) (influxdb.Check, error)
- func (s *Service) FindChecks(ctx context.Context, filter influxdb.CheckFilter, opts ...influxdb.FindOptions) ([]influxdb.Check, int, error)
- func (s *Service) FindDashboard(ctx context.Context, filter influxdb.DashboardFilter, ...) (*influxdb.Dashboard, error)
- func (s *Service) FindDashboardByID(ctx context.Context, id influxdb.ID) (*influxdb.Dashboard, error)
- func (s *Service) FindDashboards(ctx context.Context, filter influxdb.DashboardFilter, ...) ([]*influxdb.Dashboard, int, error)
- func (s *Service) FindDocumentStore(ctx context.Context, ns string) (influxdb.DocumentStore, error)
- func (s *Service) FindLabelByID(ctx context.Context, id influxdb.ID) (*influxdb.Label, error)
- func (s *Service) FindLabels(ctx context.Context, filter influxdb.LabelFilter, opt ...influxdb.FindOptions) ([]*influxdb.Label, error)
- func (s *Service) FindLogs(ctx context.Context, filter influxdb.LogFilter) ([]*influxdb.Log, int, error)
- func (s *Service) FindNotificationEndpointByID(ctx context.Context, id influxdb.ID) (influxdb.NotificationEndpoint, error)
- func (s *Service) FindNotificationEndpoints(ctx context.Context, filter influxdb.NotificationEndpointFilter, ...) (edps []influxdb.NotificationEndpoint, n int, err error)
- func (s *Service) FindNotificationRuleByID(ctx context.Context, id influxdb.ID) (influxdb.NotificationRule, error)
- func (s *Service) FindNotificationRules(ctx context.Context, filter influxdb.NotificationRuleFilter, ...) (nrs []influxdb.NotificationRule, n int, err error)
- func (s *Service) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (*influxdb.Organization, error)
- func (s *Service) FindOrganizationByID(ctx context.Context, id influxdb.ID) (*influxdb.Organization, error)
- func (s *Service) FindOrganizationByName(ctx context.Context, n string) (*influxdb.Organization, error)
- func (s *Service) FindOrganizations(ctx context.Context, filter influxdb.OrganizationFilter, ...) ([]*influxdb.Organization, int, error)
- func (s *Service) FindResourceLabels(ctx context.Context, filter influxdb.LabelMappingFilter) ([]*influxdb.Label, error)
- func (s *Service) FindResourceOrganizationID(ctx context.Context, rt influxdb.ResourceType, id influxdb.ID) (influxdb.ID, error)
- func (s *Service) FindRunByID(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)
- func (s *Service) FindRuns(ctx context.Context, filter influxdb.RunFilter) ([]*influxdb.Run, int, error)
- func (s *Service) FindSession(ctx context.Context, key string) (*influxdb.Session, error)
- func (s *Service) FindSourceByID(ctx context.Context, id influxdb.ID) (*influxdb.Source, error)
- func (s *Service) FindSources(ctx context.Context, opt influxdb.FindOptions) ([]*influxdb.Source, int, error)
- func (s *Service) FindTaskByID(ctx context.Context, id influxdb.ID) (*influxdb.Task, error)
- func (s *Service) FindTasks(ctx context.Context, filter influxdb.TaskFilter) ([]*influxdb.Task, int, error)
- func (s *Service) FindTelegrafConfigByID(ctx context.Context, id influxdb.ID) (*influxdb.TelegrafConfig, error)
- func (s *Service) FindTelegrafConfigs(ctx context.Context, filter influxdb.TelegrafConfigFilter, ...) (tcs []*influxdb.TelegrafConfig, n int, err error)
- func (s *Service) FindUser(ctx context.Context, filter influxdb.UserFilter) (*influxdb.User, error)
- func (s *Service) FindUserByID(ctx context.Context, id influxdb.ID) (*influxdb.User, error)
- func (s *Service) FindUserByName(ctx context.Context, n string) (*influxdb.User, error)
- func (s *Service) FindUserResourceMappings(ctx context.Context, filter influxdb.UserResourceMappingFilter, ...) ([]*influxdb.UserResourceMapping, int, error)
- func (s *Service) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) ([]*influxdb.User, int, error)
- func (s *Service) FindVariableByID(ctx context.Context, id influxdb.ID) (*influxdb.Variable, error)
- func (s *Service) FindVariables(ctx context.Context, filter influxdb.VariableFilter, ...) ([]*influxdb.Variable, error)
- func (s *Service) FinishRun(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)
- func (s *Service) FirstLogEntry(ctx context.Context, k []byte) ([]byte, time.Time, error)
- func (s *Service) ForEachLogEntry(ctx context.Context, k []byte, opts platform.FindOptions, ...) error
- func (s *Service) ForceRun(ctx context.Context, taskID influxdb.ID, scheduledFor int64) (*influxdb.Run, error)
- func (s *Service) GetBucketOperationLog(ctx context.Context, id influxdb.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error)
- func (s *Service) GetDashboardCellView(ctx context.Context, dashboardID, cellID influxdb.ID) (*influxdb.View, error)
- func (s *Service) GetDashboardOperationLog(ctx context.Context, id influxdb.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error)
- func (s *Service) GetOrganizationOperationLog(ctx context.Context, id influxdb.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error)
- func (s *Service) GetSecretKeys(ctx context.Context, orgID influxdb.ID) ([]string, error)
- func (s *Service) GetTargetByID(ctx context.Context, id influxdb.ID) (*influxdb.ScraperTarget, error)
- func (s *Service) GetUserOperationLog(ctx context.Context, id influxdb.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error)
- func (s *Service) Initialize(ctx context.Context) error
- func (s *Service) IsOnboarding(ctx context.Context) (bool, error)
- func (s *Service) LastLogEntry(ctx context.Context, k []byte) ([]byte, time.Time, error)
- func (s *Service) ListTargets(ctx context.Context, filter influxdb.ScraperTargetFilter) ([]influxdb.ScraperTarget, error)
- func (s *Service) LoadSecret(ctx context.Context, orgID influxdb.ID, k string) (string, error)
- func (s *Service) ManualRuns(ctx context.Context, taskID influxdb.ID) ([]*influxdb.Run, error)
- func (s *Service) Name(ctx context.Context, resource influxdb.ResourceType, id influxdb.ID) (string, error)
- func (s *Service) OnboardInitialUser(ctx context.Context, req *influxdb.OnboardingRequest) (*influxdb.OnboardingResults, error)
- func (s *Service) OnboardUser(ctx context.Context, req *influxdb.OnboardingRequest) (*influxdb.OnboardingResults, error)
- func (s *Service) PatchCheck(ctx context.Context, id influxdb.ID, upd influxdb.CheckUpdate) (influxdb.Check, error)
- func (s *Service) PatchNotificationEndpoint(ctx context.Context, id influxdb.ID, upd influxdb.NotificationEndpointUpdate) (influxdb.NotificationEndpoint, error)
- func (s *Service) PatchNotificationRule(ctx context.Context, id influxdb.ID, upd influxdb.NotificationRuleUpdate) (influxdb.NotificationRule, error)
- func (s *Service) PatchSecrets(ctx context.Context, orgID influxdb.ID, m map[string]string) error
- func (s *Service) PutAuthorization(ctx context.Context, a *influxdb.Authorization) error
- func (s *Service) PutBucket(ctx context.Context, b *influxdb.Bucket) error
- func (s *Service) PutCheck(ctx context.Context, c influxdb.Check) error
- func (s *Service) PutDashboard(ctx context.Context, d *influxdb.Dashboard) error
- func (s *Service) PutLabel(ctx context.Context, l *influxdb.Label) error
- func (s *Service) PutLabelMapping(ctx context.Context, m *influxdb.LabelMapping) error
- func (s *Service) PutNotificationEndpoint(ctx context.Context, edp influxdb.NotificationEndpoint) error
- func (s *Service) PutNotificationRule(ctx context.Context, nr influxdb.NotificationRuleCreate) error
- func (s *Service) PutOnboardingStatus(ctx context.Context, hasBeenOnboarded bool) error
- func (s *Service) PutOrganization(ctx context.Context, o *influxdb.Organization) error
- func (s *Service) PutSecret(ctx context.Context, orgID influxdb.ID, k, v string) error
- func (s *Service) PutSecrets(ctx context.Context, orgID influxdb.ID, m map[string]string) error
- func (s *Service) PutSession(ctx context.Context, sn *influxdb.Session) error
- func (s *Service) PutSource(ctx context.Context, src *influxdb.Source) error
- func (s *Service) PutTarget(ctx context.Context, target *influxdb.ScraperTarget) error
- func (s *Service) PutTelegrafConfig(ctx context.Context, tc *influxdb.TelegrafConfig) error
- func (s *Service) PutUser(ctx context.Context, u *influxdb.User) error
- func (s *Service) RemoveDashboardCell(ctx context.Context, dashboardID, cellID influxdb.ID) error
- func (s *Service) RemoveTarget(ctx context.Context, id influxdb.ID) error
- func (s *Service) RenewSession(ctx context.Context, session *influxdb.Session, newExpiration time.Time) error
- func (s *Service) ReplaceDashboardCells(ctx context.Context, id influxdb.ID, cs []*influxdb.Cell) error
- func (s *Service) ReplaceVariable(ctx context.Context, v *influxdb.Variable) error
- func (s *Service) RetryRun(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)
- func (s *Service) SetPassword(ctx context.Context, userID influxdb.ID, password string) error
- func (s *Service) StartManualRun(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)
- func (s *Service) UpdateAuthorization(ctx context.Context, id influxdb.ID, upd *influxdb.AuthorizationUpdate) (*influxdb.Authorization, error)
- func (s *Service) UpdateBucket(ctx context.Context, id influxdb.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error)
- func (s *Service) UpdateCheck(ctx context.Context, id influxdb.ID, chk influxdb.CheckCreate) (influxdb.Check, error)
- func (s *Service) UpdateDashboard(ctx context.Context, id influxdb.ID, upd influxdb.DashboardUpdate) (*influxdb.Dashboard, error)
- func (s *Service) UpdateDashboardCell(ctx context.Context, dashboardID, cellID influxdb.ID, upd influxdb.CellUpdate) (*influxdb.Cell, error)
- func (s *Service) UpdateDashboardCellView(ctx context.Context, dashboardID, cellID influxdb.ID, upd influxdb.ViewUpdate) (*influxdb.View, error)
- func (s *Service) UpdateLabel(ctx context.Context, id influxdb.ID, upd influxdb.LabelUpdate) (*influxdb.Label, error)
- func (s *Service) UpdateNotificationEndpoint(ctx context.Context, id influxdb.ID, edp influxdb.NotificationEndpoint, ...) (influxdb.NotificationEndpoint, error)
- func (s *Service) UpdateNotificationRule(ctx context.Context, id influxdb.ID, nr influxdb.NotificationRuleCreate, ...) (influxdb.NotificationRule, error)
- func (s *Service) UpdateOrganization(ctx context.Context, id influxdb.ID, upd influxdb.OrganizationUpdate) (*influxdb.Organization, error)
- func (s *Service) UpdateRunState(ctx context.Context, taskID, runID influxdb.ID, when time.Time, ...) error
- func (s *Service) UpdateSource(ctx context.Context, id influxdb.ID, upd influxdb.SourceUpdate) (*influxdb.Source, error)
- func (s *Service) UpdateTarget(ctx context.Context, update *influxdb.ScraperTarget, userID influxdb.ID) (*influxdb.ScraperTarget, error)
- func (s *Service) UpdateTask(ctx context.Context, id influxdb.ID, upd influxdb.TaskUpdate) (*influxdb.Task, error)
- func (s *Service) UpdateTelegrafConfig(ctx context.Context, id influxdb.ID, tc *influxdb.TelegrafConfig, ...) (*influxdb.TelegrafConfig, error)
- func (s *Service) UpdateUser(ctx context.Context, id influxdb.ID, upd influxdb.UserUpdate) (*influxdb.User, error)
- func (s *Service) UpdateVariable(ctx context.Context, id influxdb.ID, update *influxdb.VariableUpdate) (*influxdb.Variable, error)
- func (s *Service) WithMaxPermissionFunc(fn func(context.Context) bool)
- func (s *Service) WithResourceLogger(audit resource.Logger)
- func (s *Service) WithSpecialOrgBucketIDs(gen influxdb.IDGenerator)
- func (s *Service) WithStore(store Store)
- type ServiceConfig
- type Store
- type StoreBase
- func (s *StoreBase) Delete(ctx context.Context, tx Tx, opts DeleteOpts) error
- func (s *StoreBase) DeleteEnt(ctx context.Context, tx Tx, ent Entity) error
- func (s *StoreBase) EntKey(ctx context.Context, ent Entity) ([]byte, error)
- func (s *StoreBase) Find(ctx context.Context, tx Tx, opts FindOpts) error
- func (s *StoreBase) FindEnt(ctx context.Context, tx Tx, ent Entity) (interface{}, error)
- func (s *StoreBase) Init(ctx context.Context, tx Tx) error
- func (s *StoreBase) Put(ctx context.Context, tx Tx, ent Entity, opts ...PutOptionFn) error
- type Tx
- type VisitFunc
Constants ¶
const ( // MaxIDGenerationN is the maximum number of times an ID generation is done before failing. MaxIDGenerationN = 100 // ReservedIDs are the number of IDs reserved from 1 - ReservedIDs we use // for our system org/buckets ReservedIDs = 1000 )
const ( // DefaultSourceID it the default source identifier DefaultSourceID = "020f755c3c082000" // DefaultSourceOrganizationID is the default source's organization identifier DefaultSourceOrganizationID = "50616e67652c206c" )
const MinPasswordLength = 8
MinPasswordLength is the shortest password we allow into the system.
const OpPrefix = "kv/"
OpPrefix is the prefix for kv errors.
Variables ¶
var ( // ErrNotificationRuleNotFound is used when the notification rule is not found. ErrNotificationRuleNotFound = &influxdb.Error{ Msg: "notification rule not found", Code: influxdb.ENotFound, } // ErrInvalidNotificationRuleID is used when the service was provided // an invalid ID format. ErrInvalidNotificationRuleID = &influxdb.Error{ Code: influxdb.EInvalid, Msg: "provided notification rule ID has invalid format", } )
var ( // EIncorrectPassword is returned when any password operation fails in which // we do not want to leak information. EIncorrectPassword = &influxdb.Error{ Code: influxdb.EForbidden, Msg: "your username or password is incorrect", } // EIncorrectUser is returned when any user is failed to be found which indicates // the userID provided is for a user that does not exist. EIncorrectUser = &influxdb.Error{ Code: influxdb.EForbidden, Msg: "your userID is incorrect", } // EShortPassword is used when a password is less than the minimum // acceptable password length. EShortPassword = &influxdb.Error{ Code: influxdb.EInvalid, Msg: "passwords must be at least 8 characters long", } )
var ( // ErrScraperNotFound is used when the scraper configuration is not found. ErrScraperNotFound = &influxdb.Error{ Msg: "scraper target is not found", Code: influxdb.ENotFound, } // ErrInvalidScraperID is used when the service was provided // an invalid ID format. ErrInvalidScraperID = &influxdb.Error{ Code: influxdb.EInvalid, Msg: "provided scraper target ID has invalid format", } // ErrInvalidScrapersBucketID is used when the service was provided // an invalid ID format. ErrInvalidScrapersBucketID = &influxdb.Error{ Code: influxdb.EInvalid, Msg: "provided bucket ID has invalid format", } // ErrInvalidScrapersOrgID is used when the service was provided // an invalid ID format. ErrInvalidScrapersOrgID = &influxdb.Error{ Code: influxdb.EInvalid, Msg: "provided organization ID has invalid format", } )
var ( // ErrKeyNotFound is the error returned when the key requested is not found. ErrKeyNotFound = errors.New("key not found") // ErrTxNotWritable is the error returned when an mutable operation is called during // a non-writable transaction. ErrTxNotWritable = errors.New("transaction is not writable") // ErrSeekMissingPrefix is returned when seek bytes is missing the prefix defined via // WithCursorPrefix ErrSeekMissingPrefix = errors.New("seek missing prefix bytes") )
var ( // ErrTelegrafNotFound is used when the telegraf configuration is not found. ErrTelegrafNotFound = &influxdb.Error{ Msg: "telegraf configuration not found", Code: influxdb.ENotFound, } // ErrInvalidTelegrafID is used when the service was provided // an invalid ID format. ErrInvalidTelegrafID = &influxdb.Error{ Code: influxdb.EInvalid, Msg: "provided telegraf configuration ID has invalid format", } // ErrInvalidTelegrafOrgID is the error message for a missing or invalid organization ID. ErrInvalidTelegrafOrgID = &influxdb.Error{ Code: influxdb.EEmptyValue, Msg: "provided telegraf configuration organization ID is missing or invalid", } )
var ( // ErrInvalidURMID is used when the service was provided // an invalid ID format. ErrInvalidURMID = &influxdb.Error{ Code: influxdb.EInvalid, Msg: "provided user resource mapping ID has invalid format", } // ErrURMNotFound is used when the user resource mapping is not found. ErrURMNotFound = &influxdb.Error{ Msg: "user to resource mapping not found", Code: influxdb.ENotFound, } )
var DefaultCost = bcrypt.DefaultCost
DefaultCost is the cost that will actually be set if a cost below MinCost is passed into GenerateFromPassword
var DefaultSource = influxdb.Source{ Default: true, Name: "autogen", Type: influxdb.SelfSourceType, }
DefaultSource is the default source.
var ErrFailureGeneratingID = &influxdb.Error{
Code: influxdb.EInternal,
Msg: "unable to generate valid id",
}
ErrFailureGeneratingID occurs ony when the random number generator cannot generate an ID in MaxIDGenerationN times.
var ( // ErrMigrationSpecNotFound is returned when a migration specification is missing // for an already applied migration. ErrMigrationSpecNotFound = errors.New("migration specification not found") )
var (
// ErrNotificationEndpointNotFound is used when the notification endpoint is not found.
ErrNotificationEndpointNotFound = &influxdb.Error{
Msg: "notification endpoint not found",
Code: influxdb.ENotFound,
}
)
var (
// ErrUserNotFound is used when the user is not found.
ErrUserNotFound = &influxdb.Error{
Msg: "user not found",
Code: influxdb.ENotFound,
}
)
var NotUniqueError = &influxdb.Error{ Code: influxdb.EConflict, Msg: "name already exists", }
NotUniqueError is used when attempting to create a resource that already exists.
var NotUniqueIDError = &influxdb.Error{ Code: influxdb.EConflict, Msg: "ID already exists", }
NotUniqueIDError is used when attempting to create an org or bucket that already exists.
Functions ¶
func BucketAlreadyExistsError ¶
func BucketAlreadyExistsError(b *influxdb.Bucket) error
BucketAlreadyExistsError is used when creating a bucket with a name that already exists within an organization.
func CorruptScraperError ¶
func CorruptScraperError(err error) *influxdb.Error
CorruptScraperError is used when the config cannot be unmarshalled from the bytes stored in the kv.
func CorruptTelegrafError ¶
func CorruptTelegrafError(err error) *influxdb.Error
CorruptTelegrafError is used when the config cannot be unmarshalled from the bytes stored in the kv.
func CorruptURMError ¶
func CorruptURMError(err error) *influxdb.Error
CorruptURMError is used when the config cannot be unmarshalled from the bytes stored in the kv.
func CorruptUserIDError ¶
CorruptUserIDError is used when the ID was encoded incorrectly previously. This is some sort of internal server error.
func DecIndexID ¶
DecIndexID decodes the bucket val into an influxdb.ID.
func DecodeOrgNameKey ¶
DecodeOrgNameKey decodes a raw bucket key into the organization id and name used to create it.
func EncBodyJSON ¶
EncBodyJSON JSON encodes the entity body and returns the raw bytes and indicates that it uses the entity body.
func EncUniqKey ¶
EncUniqKey encodes the unique key.
func ErrCorruptUser ¶
func ErrCorruptUser(err error) *influxdb.Error
ErrCorruptUser is used when the user cannot be unmarshalled from the bytes stored in the kv.
func ErrCorruptUserID ¶
func ErrCorruptUserID(err error) *influxdb.Error
ErrCorruptUserID the ID stored in the Store is corrupt.
func ErrInternalUserServiceError ¶
func ErrInternalUserServiceError(err error) *influxdb.Error
ErrInternalUserServiceError is used when the error comes from an internal system.
func ErrUnprocessableMapping ¶
func ErrUnprocessableMapping(err error) *influxdb.Error
ErrUnprocessableMapping is used when a user resource mapping is not able to be converted to JSON.
func ErrUnprocessableScraper ¶
func ErrUnprocessableScraper(err error) *influxdb.Error
ErrUnprocessableScraper is used when a scraper is not able to be converted to JSON.
func ErrUnprocessableTelegraf ¶
func ErrUnprocessableTelegraf(err error) *influxdb.Error
ErrUnprocessableTelegraf is used when a telegraf is not able to be converted to JSON.
func ErrUnprocessableUser ¶
func ErrUnprocessableUser(err error) *influxdb.Error
ErrUnprocessableUser is used when a user is not able to be processed.
func InternalNotificationRuleStoreError ¶
func InternalNotificationRuleStoreError(err error) *influxdb.Error
InternalNotificationRuleStoreError is used when the error comes from an internal system.
func InternalPasswordHashError ¶
func InternalPasswordHashError(err error) *influxdb.Error
InternalPasswordHashError is used if the hasher is unable to generate a hash of the password. This is some sort of internal server error.
func InternalScraperServiceError ¶
func InternalScraperServiceError(err error) *influxdb.Error
InternalScraperServiceError is used when the error comes from an internal system.
func InternalTelegrafServiceError ¶
func InternalTelegrafServiceError(err error) *influxdb.Error
InternalTelegrafServiceError is used when the error comes from an internal system.
func InvalidUserIDError ¶
func InvalidUserIDError(err error) *influxdb.Error
InvalidUserIDError is used when a service was provided an invalid ID. This is some sort of internal server error.
func IsNotFound ¶
IsNotFound returns a boolean indicating whether the error is known to report that a key or was not found.
func MarshalUser ¶
MarshalUser turns an *influxdb.User into a byte slice.
func NonUniqueMappingError ¶
func NonUniqueMappingError(userID influxdb.ID) error
NonUniqueMappingError is an internal error when a user already has been mapped to a resource
func OrgAlreadyExistsError ¶
func OrgAlreadyExistsError(o *influxdb.Organization) error
OrgAlreadyExistsError is used when creating a new organization with a name that has already been used. Organization names must be unique.
func UnavailableNotificationRuleStoreError ¶
func UnavailableNotificationRuleStoreError(err error) *influxdb.Error
UnavailableNotificationRuleStoreError is used if we aren't able to interact with the store, it means the store is not available at the moment (e.g. network).
func UnavailablePasswordServiceError ¶
func UnavailablePasswordServiceError(err error) *influxdb.Error
UnavailablePasswordServiceError is used if we aren't able to add the password to the store, it means the store is not available at the moment (e.g. network).
func UnavailableTelegrafServiceError ¶
func UnavailableTelegrafServiceError(err error) *influxdb.Error
UnavailableTelegrafServiceError is used if we aren't able to interact with the store, it means the store is not available at the moment (e.g. network).
func UnavailableURMServiceError ¶
func UnavailableURMServiceError(err error) *influxdb.Error
UnavailableURMServiceError is used if we aren't able to interact with the store, it means the store is not available at the moment (e.g. network).
func UnexpectedAuthIndexError ¶
UnexpectedAuthIndexError is used when the error comes from an internal system.
func UnexpectedBucketError ¶
func UnexpectedBucketError(err error) *influxdb.Error
UnexpectedBucketError is used when the error comes from an internal system.
func UnexpectedBucketIndexError ¶
func UnexpectedBucketIndexError(err error) *influxdb.Error
UnexpectedBucketIndexError is used when the error comes from an internal system.
func UnexpectedIndexError ¶
UnexpectedIndexError is used when the error comes from an internal system.
func UnexpectedScrapersBucketError ¶
func UnexpectedScrapersBucketError(err error) *influxdb.Error
UnexpectedScrapersBucketError is used when the error comes from an internal system.
func UnexpectedUserBucketError ¶
func UnexpectedUserBucketError(err error) *influxdb.Error
UnexpectedUserBucketError is used when the error comes from an internal system.
func UnexpectedUserIndexError ¶
func UnexpectedUserIndexError(err error) *influxdb.Error
UnexpectedUserIndexError is used when the error comes from an internal system.
func UnmarshalUser ¶
UnmarshalUser turns the stored byte slice in the kv into a *influxdb.User.
func UserAlreadyExistsError ¶
func UserAlreadyExistsError(n string) *influxdb.Error
UserAlreadyExistsError is used when attempting to create a user with a name that already exists.
func WalkCursor ¶
func WalkCursor(ctx context.Context, cursor ForwardCursor, visit VisitFunc) (err error)
WalkCursor consumers the forward cursor call visit for each k/v pair found
func WithIndexReadPathEnabled ¶
func WithIndexReadPathEnabled(i *Index)
WithIndexReadPathEnabled enables the read paths of the index (Walk) This should be enabled once the index has been fully populated and the Insert and Delete paths are correctly integrated.
func WithPopulateRemoveDanglingForeignKeys ¶
func WithPopulateRemoveDanglingForeignKeys(c *PopulateConfig)
WithPopulateRemoveDanglingForeignKeys removes index entries which point to missing items in the source bucket.
Types ¶
type AnonymousMigration ¶
type AnonymousMigration struct {
// contains filtered or unexported fields
}
AnonymousMigration is a utility type for creating migrations from anonyomous functions.
func NewAnonymousMigration ¶
func NewAnonymousMigration(name string, up, down MigrationFunc) AnonymousMigration
NewAnonymousMigration constructs a new migration from a name string and an up and a down function.
func (AnonymousMigration) Down ¶
func (a AnonymousMigration) Down(ctx context.Context, store Store) error
Down calls the underlying down migration func.
func (AnonymousMigration) MigrationName ¶
func (a AnonymousMigration) MigrationName() string
Name returns the name of the migration.
type AutoMigrationStore ¶
AutoMigrationStore is a Store which also describes whether or not migrations can be applied automatically. Given the AutoMigrate method is defined and it returns a non-nil kv.Store implementation, then it will automatically invoke migrator.Up(store) on the returned kv.Store during Service.Initialize(...).
type Bcrypt ¶
type Bcrypt struct{}
Bcrypt implements Crypt using golang.org/x/crypto/bcrypt
func (*Bcrypt) CompareHashAndPassword ¶
CompareHashAndPassword compares a hashed password with its possible plaintext equivalent. Returns nil on success, or an error on failure.
type Bucket ¶
type Bucket interface { // TODO context? // Get returns a key within this bucket. Errors if key does not exist. Get(key []byte) ([]byte, error) // GetBatch returns a corresponding set of values for the provided // set of keys. If a value cannot be found for any provided key its // value will be nil at the same index for the provided key. GetBatch(keys ...[]byte) ([][]byte, error) // Cursor returns a cursor at the beginning of this bucket optionally // using the provided hints to improve performance. Cursor(hints ...CursorHint) (Cursor, 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 // ForwardCursor returns a forward cursor from the seek position provided. // Other options can be supplied to provide direction and hints. ForwardCursor(seek []byte, opts ...CursorOption) (ForwardCursor, error) }
Bucket is the abstraction used to perform get/put/delete/get-many operations in a key value store.
type ConvertValToEntFn ¶
ConvertValToEntFn converts a key and decoded bucket value to an entity.
type Crypt ¶
type Crypt interface { // CompareHashAndPassword compares a hashed password with its possible plaintext equivalent. // Returns nil on success, or an error on failure. CompareHashAndPassword(hashedPassword, password []byte) error // GenerateFromPassword returns the hash of the password at the given cost. // If the cost given is less than MinCost, the cost will be set to DefaultCost, instead. GenerateFromPassword(password []byte, cost int) ([]byte, error) }
Crypt represents a cryptographic hashing function.
type Cursor ¶
type Cursor interface { // Seek moves the cursor forward until reaching prefix in the key name. Seek(prefix []byte) (k []byte, v []byte) // First moves the cursor to the first key in the bucket. First() (k []byte, v []byte) // Last moves the cursor to the last key in the bucket. Last() (k []byte, v []byte) // Next moves the cursor to the next key in the bucket. Next() (k []byte, v []byte) // Prev moves the cursor to the prev key in the bucket. Prev() (k []byte, v []byte) }
Cursor is an abstraction for iterating/ranging through data. A concrete implementation of a cursor can be found in cursor.go.
func NewStaticCursor ¶
NewStaticCursor returns an instance of a StaticCursor. It destructively sorts the provided pairs to be in key ascending order.
type CursorConfig ¶
type CursorConfig struct { Direction CursorDirection Hints CursorHints Prefix []byte SkipFirst bool }
CursorConfig is a type used to configure a new forward cursor. It includes a direction and a set of hints
func NewCursorConfig ¶
func NewCursorConfig(opts ...CursorOption) CursorConfig
NewCursorConfig constructs and configures a CursorConfig used to configure a forward cursor.
type CursorDirection ¶
type CursorDirection int
CursorDirection is an integer used to define the direction a request cursor operates in.
const ( // CursorAscending directs a cursor to range in ascending order CursorAscending CursorDirection = iota // CursorAscending directs a cursor to range in descending order CursorDescending )
type CursorHint ¶
type CursorHint func(*CursorHints)
CursorHint configures CursorHints
func WithCursorHintKeyStart ¶
func WithCursorHintKeyStart(start string) CursorHint
WithCursorHintKeyStart is a hint to the store that the caller is interested in reading keys from start.
func WithCursorHintPredicate ¶
func WithCursorHintPredicate(f CursorPredicateFunc) CursorHint
WithCursorHintPredicate is a hint to the store to return only key / values which return true for the f.
The primary concern of the predicate is to improve performance. Therefore, it should perform tests on the data at minimal cost. If the predicate has no meaningful impact on reducing memory or CPU usage, there is no benefit to using it.
func WithCursorHintPrefix ¶
func WithCursorHintPrefix(prefix string) CursorHint
WithCursorHintPrefix is a hint to the store that the caller is only interested keys with the specified prefix.
type CursorHints ¶
type CursorHints struct { KeyPrefix *string KeyStart *string PredicateFn CursorPredicateFunc }
type CursorOption ¶
type CursorOption func(*CursorConfig)
CursorOption is a functional option for configuring a forward cursor
func WithCursorDirection ¶
func WithCursorDirection(direction CursorDirection) CursorOption
WithCursorDirection sets the cursor direction on a provided cursor config
func WithCursorHints ¶
func WithCursorHints(hints ...CursorHint) CursorOption
WithCursorHints configs the provided hints on the cursor config
func WithCursorPrefix ¶
func WithCursorPrefix(prefix []byte) CursorOption
WithCursorPrefix configures the forward cursor to retrieve keys with a particular prefix. This implies the cursor will start and end at a specific location based on the prefix [prefix, prefix + 1).
The value of the seek bytes must be prefixed with the provided prefix, otherwise an error will be returned.
func WithCursorSkipFirstItem ¶
func WithCursorSkipFirstItem() CursorOption
WithCursorSkipFirstItem skips returning the first item found within the seek.
type CursorPredicateFunc ¶
type DecodeBucketValFn ¶
DecodeBucketValFn decodes the raw []byte.
type DeleteOpts ¶
type DeleteOpts struct { DeleteRelationFns []DeleteRelationsFn FilterFn FilterFn }
DeleteOpts provides indicators to the store.Delete call for deleting a given entity. The FilterFn indicates the current value should be deleted when returning true.
type DeleteRelationsFn ¶
DeleteRelationsFn is a hook that a store that composes other stores can use to delete an entity and any relations it may share. An example would be deleting an an entity and its associated index.
type DocumentDecorator ¶
type DocumentDecorator struct {
// contains filtered or unexported fields
}
DocumentDecorator is used to communication the decoration of documents to the document store.
func (*DocumentDecorator) IncludeContent ¶
func (d *DocumentDecorator) IncludeContent() error
IncludeContent signals that the document should include its content when returned.
func (*DocumentDecorator) IncludeLabels ¶
func (d *DocumentDecorator) IncludeLabels() error
IncludeLabels signals that the document should include its labels when returned.
func (*DocumentDecorator) IncludeOrganizations ¶
func (d *DocumentDecorator) IncludeOrganizations() error
IncludeOwner signals that the document should include its owner.
type DocumentIndex ¶
type DocumentIndex struct {
// contains filtered or unexported fields
}
DocumentIndex implements influxdb.DocumentIndex. It is used to access labels/owners of documents.
func (*DocumentIndex) FindLabelByID ¶
func (i *DocumentIndex) FindLabelByID(id influxdb.ID) error
FindLabelByID retrieves a label by id.
func (*DocumentIndex) FindOrganizationByID ¶
func (i *DocumentIndex) FindOrganizationByID(id influxdb.ID) error
FindOrganizationByID checks if the org existence by the org id provided.
func (*DocumentIndex) FindOrganizationByName ¶
func (i *DocumentIndex) FindOrganizationByName(org string) (influxdb.ID, error)
FindOrganizationByName retrieves the organization ID of the org provided.
func (*DocumentIndex) GetAccessorsDocuments ¶
func (i *DocumentIndex) GetAccessorsDocuments(ownerType string, ownerID influxdb.ID) ([]influxdb.ID, error)
GetAccessorsDocuments retrieves the list of documents a user is allowed to access.
func (*DocumentIndex) GetDocumentsAccessors ¶
func (i *DocumentIndex) GetDocumentsAccessors(docID influxdb.ID) ([]influxdb.ID, error)
GetDocumentsAccessors retrieves the list of accessors of a document.
func (*DocumentIndex) IsOrgAccessor ¶
func (i *DocumentIndex) IsOrgAccessor(userID influxdb.ID, orgID influxdb.ID) error
IsOrgAccessor checks to see if the user is an accessor of the org provided. If the operation is writable it ensures that the user is owner.
func (*DocumentIndex) UsersOrgs ¶
func (i *DocumentIndex) UsersOrgs(userID influxdb.ID) ([]influxdb.ID, error)
UsersOrgs retrieves a list of all orgs that a user is an accessor of.
type DocumentStore ¶
type DocumentStore struct {
// contains filtered or unexported fields
}
DocumentStore implements influxdb.DocumentStore.
func (*DocumentStore) CreateDocument ¶
func (s *DocumentStore) CreateDocument(ctx context.Context, d *influxdb.Document) error
CreateDocument creates an instance of a document and sets the ID. After which it applies each of the options provided.
func (*DocumentStore) DeleteDocument ¶
func (s *DocumentStore) DeleteDocument(ctx context.Context, id influxdb.ID) error
DeleteDocument removes the specified document.
func (*DocumentStore) DeleteDocuments ¶
func (s *DocumentStore) DeleteDocuments(ctx context.Context, opts ...influxdb.DocumentFindOptions) error
DeleteDocuments removes all documents returned by the options.
func (*DocumentStore) FindDocument ¶
func (s *DocumentStore) FindDocument(ctx context.Context, id influxdb.ID) (*influxdb.Document, error)
FindDocument retrieves the specified document with all its content and labels.
func (*DocumentStore) FindDocuments ¶
func (s *DocumentStore) FindDocuments(ctx context.Context, opts ...influxdb.DocumentFindOptions) ([]*influxdb.Document, error)
FindDocuments retrieves all documents returned by the document find options.
func (*DocumentStore) PutDocument ¶
func (s *DocumentStore) PutDocument(ctx context.Context, d *influxdb.Document) error
func (*DocumentStore) UpdateDocument ¶
func (s *DocumentStore) UpdateDocument(ctx context.Context, d *influxdb.Document) error
UpdateDocument updates the document.
type EncodeEntFn ¶
EncodeEntFn encodes the entity. This is used both for the key and vals in the store base.
type EncodeFn ¶
EncodeFn returns an encoding when called. Closures are your friend here.
func EncStringCaseInsensitive ¶
EncStringCaseInsensitive encodes a string and makes it case insensitive by lower casing everything.
type FilterFn ¶
FilterFn will provide an indicator to the Find or Delete calls that the entity that was seen is one that is valid and should be either captured or deleted (depending on the caller of the filter func).
type FindCaptureFn ¶
FindCaptureFn is the mechanism for closing over the key and decoded value pair for adding results to the call sites collection. This generic implementation allows it to be reused. The returned decodedVal should always satisfy whatever decoding of the bucket value was set on the storeo that calls Find.
type FindOpts ¶
type FindOpts struct { Descending bool Offset int Limit int Prefix []byte CaptureFn FindCaptureFn FilterEntFn FilterFn }
FindOpts provided a means to search through the bucket. When a filter func is provided, that will run against the entity and if the filter responds true, will count it towards the number of entries seen and the capture func will be run with it provided to it.
type ForwardCursor ¶
type ForwardCursor interface { // Next moves the cursor to the next key in the bucket. Next() (k, v []byte) // Err returns non-nil if an error occurred during cursor iteration. // This should always be checked after Next returns a nil key/value. Err() error // Close is reponsible for freeing any resources created by the cursor. Close() error }
ForwardCursor is an abstraction for interacting/ranging through data in one direction.
type Index ¶
type Index struct { IndexMapping // contains filtered or unexported fields }
Index is used to define and manage an index for a source bucket.
When using the index you must provide it with an IndexMapping. The IndexMapping provides the index with the contract it needs to populate the entire index and traverse a populated index correctly. The IndexMapping provides a way to retrieve the key on which to index with when provided with the value from the source. It also provides the way to access the source bucket.
The following is an illustration of its use:
byUserID := func(v []byte) ([]byte, error) { auth := &influxdb.Authorization{} if err := json.Unmarshal(v, auth); err != nil { return err } return auth.UserID.Encode() } // configure a write only index indexByUser := NewIndex(NewSource([]byte(`authorizationsbyuserv1/), byUserID)) indexByUser.Insert(tx, someUserID, someAuthID) indexByUser.Delete(tx, someUserID, someAuthID) indexByUser.Walk(tx, someUserID, func(k, v []byte) error { auth := &influxdb.Authorization{} if err := json.Unmarshal(v, auth); err != nil { return err } // do something with auth return nil }) // populate entire index from source indexedCount, err := indexByUser.Populate(ctx, store) // verify the current index against the source and return the differences // found in each diff, err := indexByUser.Verify(ctx, tx)
func NewIndex ¶
func NewIndex(mapping IndexMapping, opts ...IndexOption) *Index
NewIndex configures and returns a new *Index for a given index mapping. By default the read path (Walk) is disabled. This is because the index needs to be fully populated before depending upon the read path. The read path can be enabled using WithIndexReadPathEnabled option.
func (*Index) Delete ¶
Delete removes the foreignKey and primaryKey mapping from the underlying index.
func (*Index) Insert ¶
Insert creates a single index entry for the provided primary key on the foreign key.
func (*Index) Migration ¶
func (i *Index) Migration(opts ...PopulateOption) *IndexMigration
Migration creates an IndexMigration for the underlying Index.
func (*Index) Populate ¶
func (i *Index) Populate(ctx context.Context, store Store, opts ...PopulateOption) (n int, err error)
Populate does a full population of the index using the IndexSourceOn IndexMapping function. Once completed it marks the index as ready for use. It return a nil error on success and the count of inserted items.
type IndexDiff ¶
type IndexDiff struct { // PresentInIndex is a map of foreign key to primary keys // present in the index. PresentInIndex map[string]map[string]struct{} // MissingFromIndex is a map of foreign key to associated primary keys // missing from the index given the source bucket. // These items could be due to the fact an index populate migration has // not yet occured, the index populate code is incorrect or the write path // for your resource type does not yet insert into the index as well (Create actions). MissingFromIndex map[string]map[string]struct{} // MissingFromSource is a map of foreign key to associated primary keys // missing from the source but accounted for in the index. // This happens when index items are not properly removed from the index // when an item is removed from the source (Delete actions). MissingFromSource map[string]map[string]struct{} }
IndexDiff contains a set of items present in the source not in index, along with a set of things in the index which are not in the source.
type IndexMapping ¶
type IndexMapping interface { SourceBucket() []byte IndexBucket() []byte IndexSourceOn(value []byte) (foreignKey []byte, err error) }
IndexMapping is a type which configures and Index to map items from a source bucket to an index bucket via a mapping known as IndexSourceOn. This function is called on the values in the source to derive the foreign key on which to index each item.
func NewIndexMapping ¶
func NewIndexMapping(sourceBucket, indexBucket []byte, fn IndexSourceOnFunc) IndexMapping
NewIndexMapping creates an implementation of IndexMapping for the provided source bucket to a destination index bucket.
type IndexMigration ¶
type IndexMigration struct { *Index // contains filtered or unexported fields }
IndexMigration is a migration for adding and removing an index. These are constructed via the Index.Migration function.
func (*IndexMigration) Down ¶
func (i *IndexMigration) Down(ctx context.Context, store Store) error
Down deletes all entries from the index.
func (*IndexMigration) MigrationName ¶
func (i *IndexMigration) MigrationName() string
Name returns a readable name for the index migration.
type IndexOption ¶
type IndexOption func(*Index)
IndexOption is a function which configures an index
func WithIndexPopulateBatchSize ¶
func WithIndexPopulateBatchSize(n int) IndexOption
WithIndexPopulateBatchSize configures the size of each batch used when fully populating an index. (number of puts per tx)
type IndexSourceOnFunc ¶
IndexSourceOnFunc is a function which can be used to derive the foreign key of a value in a source bucket.
type IndexStore ¶
IndexStore provides a entity store that uses an index lookup. The index store manages deleting and creating indexes for the caller. The index is automatically used if the FindEnt entity entity does not have the primary key.
func (*IndexStore) Delete ¶
func (s *IndexStore) Delete(ctx context.Context, tx Tx, opts DeleteOpts) error
Delete deletes entities and associated indexes.
func (*IndexStore) Find ¶
Find provides a mechanism for looking through the bucket via the set options. When a prefix is provided, it will be used within the entity store. If you would like to search the index store, then you can by calling the index store directly.
func (*IndexStore) FindEnt ¶
FindEnt returns the decoded entity body via teh provided entity. An example entity should not include a Body, but rather the ID, Name, or OrgID. If no ID is provided, then the algorithm assumes you are looking up the entity by the index.
func (*IndexStore) Init ¶
func (s *IndexStore) Init(ctx context.Context, tx Tx) error
Init creates the entity and index buckets.
func (*IndexStore) Put ¶
func (s *IndexStore) Put(ctx context.Context, tx Tx, ent Entity, opts ...PutOptionFn) error
Put will persist the entity into both the entity store and the index store.
type Migration ¶
type Migration struct { ID influxdb.ID `json:"id"` Name string `json:"name"` State MigrationState `json:"-"` StartedAt *time.Time `json:"started_at"` FinishedAt *time.Time `json:"finished_at,omitempty"` }
Migration is a record of a particular migration.
type MigrationFunc ¶
MigrationFunc is a function which can be used as either an up or down operation.
type MigrationSpec ¶
type MigrationSpec interface { MigrationName() string Up(ctx context.Context, store Store) error Down(ctx context.Context, store Store) error }
MigrationSpec is a specification for a particular migration. It describes the name of the migration and up and down operations needed to fulfill the migration.
type MigrationState ¶
type MigrationState uint
MigrationState is a type for describing the state of a migration.
const ( // DownMigrationState is for a migration not yet applied. DownMigrationState MigrationState = iota // UpMigration State is for a migration which has been applied. UpMigrationState )
func (MigrationState) String ¶
func (s MigrationState) String() string
String returns a string representation for a migration state.
type Migrator ¶
type Migrator struct { MigrationSpecs []MigrationSpec // contains filtered or unexported fields }
Migrator is a type which manages migrations. It takes a list of migration specifications and undo (down) all or apply (up) outstanding migrations. It records the state of the world in store under the migrations bucket.
func NewMigrator ¶
func NewMigrator(logger *zap.Logger, ms ...MigrationSpec) *Migrator
NewMigrator constructs and configures a new Migrator.
func (*Migrator) AddMigrations ¶
func (m *Migrator) AddMigrations(ms ...MigrationSpec)
AddMigrations appends the provided migration specs onto the Migrator.
func (*Migrator) Down ¶
Down applies the down operation of each currently applied migration. Migrations are applied in reverse order from the highest indexed migration in a down state.
For example, given: 0001 add bucket foo | (up) 0002 add bucket bar | (up) 0003 add index "foo on baz" | (down)
Down would call down() on 0002 and then on 0001.
func (*Migrator) Initialize ¶
Initialize creates the migration bucket if it does not yet exist.
func (*Migrator) List ¶
List returns a list of migrations and their states within the provided store.
func (*Migrator) Up ¶
Up applies each outstanding migration in order. Migrations are applied in order from the lowest indexed migration in a down state.
For example, given: 0001 add bucket foo | (up) 0002 add bucket bar | (down) 0003 add index "foo on baz" | (down)
Up would apply migration 0002 and then 0003.
type PopulateConfig ¶
type PopulateConfig struct {
RemoveDanglingForeignKeys bool
}
PopulateConfig configures a call to Populate
type PopulateOption ¶
type PopulateOption func(*PopulateConfig)
PopulateOption is a functional option for the Populate call
type PutOptionFn ¶
type PutOptionFn func(o *putOption) error
PutOptionFn provides a hint to the store to make some guarantees about the put action. I.e. If it is new, then will validate there is no existing entity by the given PK.
func PutNew ¶
func PutNew() PutOptionFn
PutNew will create an entity that is not does not already exist. Guarantees uniqueness by the store's uniqueness guarantees.
func PutUpdate ¶
func PutUpdate() PutOptionFn
PutUpdate will update an entity that must already exist.
type Service ¶
type Service struct { Config ServiceConfig IDGenerator influxdb.IDGenerator // special ID generator that never returns bytes with backslash, // comma, or space. Used to support very specific encoding of org & // bucket into the old measurement in storage. OrgBucketIDs influxdb.IDGenerator TokenGenerator influxdb.TokenGenerator // TODO(desa:ariel): this should not be embedded influxdb.TimeGenerator Hash Crypt Migrator *Migrator // contains filtered or unexported fields }
Service is the struct that influxdb services are implemented on.
func NewService ¶
func NewService(log *zap.Logger, kv Store, configs ...ServiceConfig) *Service
NewService returns an instance of a Service.
func (*Service) AddDashboardCell ¶
func (s *Service) AddDashboardCell(ctx context.Context, id influxdb.ID, cell *influxdb.Cell, opts influxdb.AddDashboardCellOptions) error
AddDashboardCell adds a cell to a dashboard and sets the cells ID.
func (*Service) AddLogEntry ¶
AddLogEntry logs an keyValue for a particular resource type ID pairing.
func (*Service) AddRunLog ¶
func (s *Service) AddRunLog(ctx context.Context, taskID, runID influxdb.ID, when time.Time, log string) error
AddRunLog adds a log line to the run.
func (*Service) AddTarget ¶
func (s *Service) AddTarget(ctx context.Context, target *influxdb.ScraperTarget, userID influxdb.ID) (err error)
AddTarget add a new scraper target into storage.
func (*Service) CompareAndSetPassword ¶
func (s *Service) CompareAndSetPassword(ctx context.Context, userID influxdb.ID, old string, new string) error
CompareAndSetPassword checks the password and if they match updates to the new password.
func (*Service) ComparePassword ¶
ComparePassword checks if the password matches the password recorded. Passwords that do not match return errors.
func (*Service) CreateAuthorization ¶
CreateAuthorization creates a influxdb authorization and sets b.ID, and b.UserID if not provided.
func (*Service) CreateAuthorizationTx ¶
func (s *Service) CreateAuthorizationTx(ctx context.Context, tx Tx, a *influxdb.Authorization) error
CreateAuthorizationTx is used when importing kv as a library
func (*Service) CreateBucket ¶
CreateBucket creates a influxdb bucket and sets b.ID.
func (*Service) CreateBucketTx ¶
CreateBucketTx is used when importing kv as a library
func (*Service) CreateCheck ¶
func (s *Service) CreateCheck(ctx context.Context, c influxdb.CheckCreate, userID influxdb.ID) error
CreateCheck creates a influxdb check and sets ID.
func (*Service) CreateDashboard ¶
CreateDashboard creates a influxdb dashboard and sets d.ID.
func (*Service) CreateDocumentStore ¶
func (s *Service) CreateDocumentStore(ctx context.Context, ns string) (influxdb.DocumentStore, error)
CreateDocumentStore creates an instance of a document store by instantiating the buckets for the store.
func (*Service) CreateLabel ¶
CreateLabel creates a new label.
func (*Service) CreateLabelMapping ¶
CreateLabelMapping creates a new mapping between a resource and a label.
func (*Service) CreateNotificationEndpoint ¶
func (s *Service) CreateNotificationEndpoint(ctx context.Context, edp influxdb.NotificationEndpoint, userID influxdb.ID) error
CreateNotificationEndpoint creates a new notification endpoint and sets b.ID with the new identifier.
func (*Service) CreateNotificationRule ¶
func (s *Service) CreateNotificationRule(ctx context.Context, nr influxdb.NotificationRuleCreate, userID influxdb.ID) error
CreateNotificationRule creates a new notification rule and sets b.ID with the new identifier.
func (*Service) CreateOrganization ¶
CreateOrganization creates a influxdb organization and sets b.ID.
func (*Service) CreateOrganizationTx ¶
func (s *Service) CreateOrganizationTx(ctx context.Context, tx Tx, o *influxdb.Organization) (err error)
CreateOrganizationTx is used when importing kv as a library
func (*Service) CreateRun ¶
func (s *Service) CreateRun(ctx context.Context, taskID influxdb.ID, scheduledFor time.Time, runAt time.Time) (*influxdb.Run, error)
CreateRun creates a run with a scheduledFor time as now.
func (*Service) CreateSession ¶
CreateSession creates a session for a user with the users maximal privileges.
func (*Service) CreateSource ¶
CreateSource creates a influxdb source and sets s.ID.
func (*Service) CreateSystemBuckets ¶
CreateSystemBuckets for an organization
func (*Service) CreateTask ¶
CreateTask creates a new task. The owner of the task is inferred from the authorizer associated with ctx.
func (*Service) CreateTelegrafConfig ¶
func (s *Service) CreateTelegrafConfig(ctx context.Context, tc *influxdb.TelegrafConfig, userID influxdb.ID) error
CreateTelegrafConfig creates a new telegraf config and sets b.ID with the new identifier.
func (*Service) CreateUser ¶
CreateUser creates a influxdb user and sets b.ID.
func (*Service) CreateUserResourceMapping ¶
func (s *Service) CreateUserResourceMapping(ctx context.Context, m *influxdb.UserResourceMapping) error
CreateUserResourceMapping associates a user to a resource either as a member or owner.
func (*Service) CreateUserResourceMappingForOrg ¶
func (s *Service) CreateUserResourceMappingForOrg(ctx context.Context, tx Tx, orgID influxdb.ID, resID influxdb.ID, resType influxdb.ResourceType) error
CreateUserResourceMappingForOrg is a public function that calls createUserResourceMappingForOrg used only for the label service it can be removed when URMs are removed from the label service
func (*Service) CreateUserResourceMappingTx ¶
func (s *Service) CreateUserResourceMappingTx(ctx context.Context, tx Tx, m *influxdb.UserResourceMapping) error
CreateUserResourceMappingTx is used when importing kv as a library
func (*Service) CreateUserTx ¶
CreateUserTx is used when importing kv as a library
func (*Service) CreateVariable ¶
CreateVariable creates a new variable and assigns it an ID
func (*Service) CurrentlyRunning ¶
func (*Service) DefaultSource ¶
DefaultSource retrieves the default source.
func (*Service) DeleteAuthorization ¶
DeleteAuthorization deletes a authorization and prunes it from the index.
func (*Service) DeleteBucket ¶
DeleteBucket deletes a bucket and prunes it from the index.
func (*Service) DeleteCheck ¶
DeleteCheck deletes a check and prunes it from the index.
func (*Service) DeleteDashboard ¶
DeleteDashboard deletes a dashboard and prunes it from the index.
func (*Service) DeleteLabel ¶
DeleteLabel deletes a label.
func (*Service) DeleteLabelMapping ¶
DeleteLabelMapping deletes a label mapping.
func (*Service) DeleteNotificationEndpoint ¶
func (s *Service) DeleteNotificationEndpoint(ctx context.Context, id influxdb.ID) (flds []influxdb.SecretField, orgID influxdb.ID, err error)
DeleteNotificationEndpoint removes a notification endpoint by ID.
func (*Service) DeleteNotificationRule ¶
DeleteNotificationRule removes a notification rule by ID.
func (*Service) DeleteOrganization ¶
DeleteOrganization deletes a organization and prunes it from the index.
func (*Service) DeleteSecret ¶
DeleteSecret removes secrets from the secret store.
func (*Service) DeleteSource ¶
DeleteSource deletes a source and prunes it from the index.
func (*Service) DeleteTask ¶
DeleteTask removes a task by ID and purges all associated data and scheduled runs.
func (*Service) DeleteTelegrafConfig ¶
DeleteTelegrafConfig removes a telegraf config by ID.
func (*Service) DeleteUser ¶
DeleteUser deletes a user and prunes it from the index.
func (*Service) DeleteUserResourceMapping ¶
func (s *Service) DeleteUserResourceMapping(ctx context.Context, resourceID influxdb.ID, userID influxdb.ID) error
DeleteUserResourceMapping deletes a user resource mapping.
func (*Service) DeleteVariable ¶
DeleteVariable removes a single variable from the store by its ID
func (*Service) ExpireSession ¶
ExpireSession expires the session at the provided key.
func (*Service) FindAuthorizationByID ¶
func (s *Service) FindAuthorizationByID(ctx context.Context, id influxdb.ID) (*influxdb.Authorization, error)
FindAuthorizationByID retrieves a authorization by id.
func (*Service) FindAuthorizationByToken ¶
func (s *Service) FindAuthorizationByToken(ctx context.Context, n string) (*influxdb.Authorization, error)
FindAuthorizationByToken returns a authorization by token for a particular authorization.
func (*Service) FindAuthorizations ¶
func (s *Service) FindAuthorizations(ctx context.Context, filter influxdb.AuthorizationFilter, opt ...influxdb.FindOptions) ([]*influxdb.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 (*Service) FindBucket ¶
func (s *Service) FindBucket(ctx context.Context, filter influxdb.BucketFilter) (*influxdb.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 (*Service) FindBucketByID ¶
FindBucketByID retrieves a bucket by id.
func (*Service) FindBucketByName ¶
func (s *Service) FindBucketByName(ctx context.Context, orgID influxdb.ID, n string) (*influxdb.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 (*Service) FindBuckets ¶
func (s *Service) FindBuckets(ctx context.Context, filter influxdb.BucketFilter, opts ...influxdb.FindOptions) ([]*influxdb.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 (*Service) FindCheck ¶
func (s *Service) FindCheck(ctx context.Context, filter influxdb.CheckFilter) (influxdb.Check, error)
FindCheck retrives a check using an arbitrary check filter. Filters using ID, or OrganizationID and check Name should be efficient. Other filters will do a linear scan across checks until it finds a match.
func (*Service) FindCheckByID ¶
FindCheckByID retrieves a check by id.
func (*Service) FindChecks ¶
func (s *Service) FindChecks(ctx context.Context, filter influxdb.CheckFilter, opts ...influxdb.FindOptions) ([]influxdb.Check, int, error)
FindChecks retrieves all checks that match an arbitrary check filter. Filters using ID, or OrganizationID and check Name should be efficient. Other filters will do a linear scan across all checks searching for a match.
func (*Service) FindDashboard ¶
func (s *Service) FindDashboard(ctx context.Context, filter influxdb.DashboardFilter, opts ...influxdb.FindOptions) (*influxdb.Dashboard, error)
FindDashboard retrieves a dashboard using an arbitrary dashboard filter.
func (*Service) FindDashboardByID ¶
func (s *Service) FindDashboardByID(ctx context.Context, id influxdb.ID) (*influxdb.Dashboard, error)
FindDashboardByID retrieves a dashboard by id.
func (*Service) FindDashboards ¶
func (s *Service) FindDashboards(ctx context.Context, filter influxdb.DashboardFilter, opts influxdb.FindOptions) ([]*influxdb.Dashboard, int, error)
FindDashboards retrives all dashboards that match an arbitrary dashboard filter.
func (*Service) FindDocumentStore ¶
FindDocumentStore finds the buckets associated with the namespace provided.
func (*Service) FindLabelByID ¶
FindLabelByID finds a label by its ID
func (*Service) FindLabels ¶
func (s *Service) FindLabels(ctx context.Context, filter influxdb.LabelFilter, opt ...influxdb.FindOptions) ([]*influxdb.Label, error)
FindLabels returns a list of labels that match a filter.
func (*Service) FindLogs ¶
func (s *Service) FindLogs(ctx context.Context, filter influxdb.LogFilter) ([]*influxdb.Log, int, error)
FindLogs returns logs for a run.
func (*Service) FindNotificationEndpointByID ¶
func (s *Service) FindNotificationEndpointByID(ctx context.Context, id influxdb.ID) (influxdb.NotificationEndpoint, error)
FindNotificationEndpointByID returns a single notification endpoint by ID.
func (*Service) FindNotificationEndpoints ¶
func (s *Service) FindNotificationEndpoints(ctx context.Context, filter influxdb.NotificationEndpointFilter, opt ...influxdb.FindOptions) (edps []influxdb.NotificationEndpoint, n int, err error)
FindNotificationEndpoints returns a list of notification endpoints that match isNext and the total count of matching notification endpoints. Additional options provide pagination & sorting.
func (*Service) FindNotificationRuleByID ¶
func (s *Service) FindNotificationRuleByID(ctx context.Context, id influxdb.ID) (influxdb.NotificationRule, error)
FindNotificationRuleByID returns a single notification rule by ID.
func (*Service) FindNotificationRules ¶
func (s *Service) FindNotificationRules(ctx context.Context, filter influxdb.NotificationRuleFilter, opt ...influxdb.FindOptions) (nrs []influxdb.NotificationRule, n int, err error)
FindNotificationRules returns a list of notification rules that match filter and the total count of matching notification rules. Additional options provide pagination & sorting.
func (*Service) FindOrganization ¶
func (s *Service) FindOrganization(ctx context.Context, filter influxdb.OrganizationFilter) (*influxdb.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 (*Service) FindOrganizationByID ¶
func (s *Service) FindOrganizationByID(ctx context.Context, id influxdb.ID) (*influxdb.Organization, error)
FindOrganizationByID retrieves a organization by id.
func (*Service) FindOrganizationByName ¶
func (s *Service) FindOrganizationByName(ctx context.Context, n string) (*influxdb.Organization, error)
FindOrganizationByName returns a organization by name for a particular organization.
func (*Service) FindOrganizations ¶
func (s *Service) FindOrganizations(ctx context.Context, filter influxdb.OrganizationFilter, opt ...influxdb.FindOptions) ([]*influxdb.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 (*Service) FindResourceLabels ¶
func (*Service) FindResourceOrganizationID ¶
func (s *Service) FindResourceOrganizationID(ctx context.Context, rt influxdb.ResourceType, id influxdb.ID) (influxdb.ID, error)
FindResourceOrganizationID is used to find the organization that a resource belongs to five the id of a resource and a resource type.
func (*Service) FindRunByID ¶
func (s *Service) FindRunByID(ctx context.Context, taskID, runID influxdb.ID) (*influxdb.Run, error)
FindRunByID returns a single run.
func (*Service) FindRuns ¶
func (s *Service) FindRuns(ctx context.Context, filter influxdb.RunFilter) ([]*influxdb.Run, int, error)
FindRuns returns a list of runs that match a filter and the total count of returned runs.
func (*Service) FindSession ¶
FindSession retrieves the session found at the provided key.
func (*Service) FindSourceByID ¶
FindSourceByID retrieves a source by id.
func (*Service) FindSources ¶
func (s *Service) FindSources(ctx context.Context, opt influxdb.FindOptions) ([]*influxdb.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 (*Service) FindTaskByID ¶
FindTaskByID returns a single task
func (*Service) FindTasks ¶
func (s *Service) FindTasks(ctx context.Context, filter influxdb.TaskFilter) ([]*influxdb.Task, int, error)
FindTasks returns a list of tasks that match a filter (limit 100) and the total count of matching tasks.
func (*Service) FindTelegrafConfigByID ¶
func (s *Service) FindTelegrafConfigByID(ctx context.Context, id influxdb.ID) (*influxdb.TelegrafConfig, error)
FindTelegrafConfigByID returns a single telegraf config by ID.
func (*Service) FindTelegrafConfigs ¶
func (s *Service) FindTelegrafConfigs(ctx context.Context, filter influxdb.TelegrafConfigFilter, opt ...influxdb.FindOptions) (tcs []*influxdb.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) FindUser ¶
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 (*Service) FindUserByID ¶
FindUserByID retrieves a user by id.
func (*Service) FindUserByName ¶
FindUserByName returns a user by name for a particular user.
func (*Service) FindUserResourceMappings ¶
func (s *Service) FindUserResourceMappings(ctx context.Context, filter influxdb.UserResourceMappingFilter, opt ...influxdb.FindOptions) ([]*influxdb.UserResourceMapping, int, error)
FindUserResourceMappings returns a list of UserResourceMappings that match filter and the total count of matching mappings.
func (*Service) FindUsers ¶
func (s *Service) FindUsers(ctx context.Context, filter influxdb.UserFilter, opt ...influxdb.FindOptions) ([]*influxdb.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 (*Service) FindVariableByID ¶
FindVariableByID finds a single variable in the store by its ID
func (*Service) FindVariables ¶
func (s *Service) FindVariables(ctx context.Context, filter influxdb.VariableFilter, opt ...influxdb.FindOptions) ([]*influxdb.Variable, error)
FindVariables returns all variables in the store
func (*Service) FinishRun ¶
FinishRun removes runID from the list of running tasks and if its `now` is later then last completed update it.
func (*Service) FirstLogEntry ¶
FirstLogEntry retrieves the first log entry for a key value log.
func (*Service) ForEachLogEntry ¶
func (s *Service) ForEachLogEntry(ctx context.Context, k []byte, opts platform.FindOptions, fn func([]byte, time.Time) error) error
ForEachLogEntry retrieves the keyValue log for a resource type ID combination. KeyValues may be returned in ascending and descending order.
func (*Service) ForceRun ¶
func (s *Service) ForceRun(ctx context.Context, taskID influxdb.ID, scheduledFor int64) (*influxdb.Run, error)
ForceRun forces a run to occur with unix timestamp scheduledFor, to be executed as soon as possible. The value of scheduledFor may or may not align with the task's schedule.
func (*Service) GetBucketOperationLog ¶
func (s *Service) GetBucketOperationLog(ctx context.Context, id influxdb.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error)
GetBucketOperationLog retrieves a buckets operation log.
func (*Service) GetDashboardCellView ¶
func (s *Service) GetDashboardCellView(ctx context.Context, dashboardID, cellID influxdb.ID) (*influxdb.View, error)
GetDashboardCellView retrieves the view for a dashboard cell.
func (*Service) GetDashboardOperationLog ¶
func (s *Service) GetDashboardOperationLog(ctx context.Context, id influxdb.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error)
GetDashboardOperationLog retrieves a dashboards operation log.
func (*Service) GetOrganizationOperationLog ¶
func (s *Service) GetOrganizationOperationLog(ctx context.Context, id influxdb.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error)
GetOrganizationOperationLog retrieves a organization operation log.
func (*Service) GetSecretKeys ¶
GetSecretKeys retrieves all secret keys that are stored for the organization orgID.
func (*Service) GetTargetByID ¶
func (s *Service) GetTargetByID(ctx context.Context, id influxdb.ID) (*influxdb.ScraperTarget, error)
GetTargetByID retrieves a scraper target by id.
func (*Service) GetUserOperationLog ¶
func (s *Service) GetUserOperationLog(ctx context.Context, id influxdb.ID, opts influxdb.FindOptions) ([]*influxdb.OperationLogEntry, int, error)
GetUserOperationLog retrieves a user operation log.
func (*Service) Initialize ¶
Initialize creates Buckets needed.
func (*Service) IsOnboarding ¶
IsOnboarding means if the initial setup of influxdb has happened. true means that the onboarding setup has not yet happened. false means that the onboarding has been completed.
func (*Service) LastLogEntry ¶
LastLogEntry retrieves the first log entry for a key value log.
func (*Service) ListTargets ¶
func (s *Service) ListTargets(ctx context.Context, filter influxdb.ScraperTargetFilter) ([]influxdb.ScraperTarget, error)
ListTargets will list all scrape targets.
func (*Service) LoadSecret ¶
LoadSecret retrieves the secret value v found at key k for organization orgID.
func (*Service) ManualRuns ¶
func (*Service) Name ¶
func (s *Service) Name(ctx context.Context, resource influxdb.ResourceType, id influxdb.ID) (string, error)
Name returns the name for the resource and ID.
func (*Service) OnboardInitialUser ¶
func (s *Service) OnboardInitialUser(ctx context.Context, req *influxdb.OnboardingRequest) (*influxdb.OnboardingResults, error)
OnboardInitialUser OnboardingResults from onboarding request, update db so this request will be disabled for the second run.
func (*Service) OnboardUser ¶
func (*Service) PatchCheck ¶
func (s *Service) PatchCheck(ctx context.Context, id influxdb.ID, upd influxdb.CheckUpdate) (influxdb.Check, error)
PatchCheck updates a check according the parameters set on upd.
func (*Service) PatchNotificationEndpoint ¶
func (s *Service) PatchNotificationEndpoint(ctx context.Context, id influxdb.ID, upd influxdb.NotificationEndpointUpdate) (influxdb.NotificationEndpoint, error)
PatchNotificationEndpoint updates a single notification endpoint with changeset. Returns the new notification endpoint state after update.
func (*Service) PatchNotificationRule ¶
func (s *Service) PatchNotificationRule(ctx context.Context, id influxdb.ID, upd influxdb.NotificationRuleUpdate) (influxdb.NotificationRule, error)
PatchNotificationRule updates a single notification rule with changeset. Returns the new notification rule state after update.
func (*Service) PatchSecrets ¶
PatchSecrets patches all provided secrets and updates any previous values.
func (*Service) PutAuthorization ¶
PutAuthorization will put a authorization without setting an ID.
func (*Service) PutDashboard ¶
PutDashboard will put a dashboard without setting an ID.
func (*Service) PutLabel ¶
PutLabel creates a label from the provided struct, without generating a new ID.
func (*Service) PutLabelMapping ¶
PutLabelMapping writes a label mapping to boltdb
func (*Service) PutNotificationEndpoint ¶
func (s *Service) PutNotificationEndpoint(ctx context.Context, edp influxdb.NotificationEndpoint) error
PutNotificationEndpoint put a notification endpoint to storage.
func (*Service) PutNotificationRule ¶
func (s *Service) PutNotificationRule(ctx context.Context, nr influxdb.NotificationRuleCreate) error
PutNotificationRule put a notification rule to storage.
func (*Service) PutOnboardingStatus ¶
PutOnboardingStatus will update the flag, so future onboarding request will be denied. true means that onboarding is NOT needed. false means that onboarding is needed.
func (*Service) PutOrganization ¶
PutOrganization will put a organization without setting an ID.
func (*Service) PutSecrets ¶
PutSecrets puts all provided secrets and overwrites any previous values.
func (*Service) PutSession ¶
PutSession puts the session at key.
func (*Service) PutTelegrafConfig ¶
PutTelegrafConfig put a telegraf config to storage.
func (*Service) RemoveDashboardCell ¶
RemoveDashboardCell removes a cell from a dashboard.
func (*Service) RemoveTarget ¶
RemoveTarget removes a scraper target from the bucket.
func (*Service) RenewSession ¶
func (s *Service) RenewSession(ctx context.Context, session *influxdb.Session, newExpiration time.Time) error
RenewSession extends the expire time to newExpiration.
func (*Service) ReplaceDashboardCells ¶
func (s *Service) ReplaceDashboardCells(ctx context.Context, id influxdb.ID, cs []*influxdb.Cell) error
ReplaceDashboardCells updates the positions of each cell in a dashboard concurrently.
func (*Service) ReplaceVariable ¶
ReplaceVariable puts a variable in the store
func (*Service) RetryRun ¶
RetryRun creates and returns a new run (which is a retry of another run).
func (*Service) SetPassword ¶
SetPassword overrides the password of a known user.
func (*Service) StartManualRun ¶
func (*Service) UpdateAuthorization ¶
func (s *Service) UpdateAuthorization(ctx context.Context, id influxdb.ID, upd *influxdb.AuthorizationUpdate) (*influxdb.Authorization, error)
UpdateAuthorization updates the status and description if available.
func (*Service) UpdateBucket ¶
func (s *Service) UpdateBucket(ctx context.Context, id influxdb.ID, upd influxdb.BucketUpdate) (*influxdb.Bucket, error)
UpdateBucket updates a bucket according the parameters set on upd.
func (*Service) UpdateCheck ¶
func (s *Service) UpdateCheck(ctx context.Context, id influxdb.ID, chk influxdb.CheckCreate) (influxdb.Check, error)
UpdateCheck updates the check.
func (*Service) UpdateDashboard ¶
func (s *Service) UpdateDashboard(ctx context.Context, id influxdb.ID, upd influxdb.DashboardUpdate) (*influxdb.Dashboard, error)
UpdateDashboard updates a dashboard according the parameters set on upd.
func (*Service) UpdateDashboardCell ¶
func (s *Service) UpdateDashboardCell(ctx context.Context, dashboardID, cellID influxdb.ID, upd influxdb.CellUpdate) (*influxdb.Cell, error)
UpdateDashboardCell udpates a cell on a dashboard.
func (*Service) UpdateDashboardCellView ¶
func (s *Service) UpdateDashboardCellView(ctx context.Context, dashboardID, cellID influxdb.ID, upd influxdb.ViewUpdate) (*influxdb.View, error)
UpdateDashboardCellView updates the view for a dashboard cell.
func (*Service) UpdateLabel ¶
func (s *Service) UpdateLabel(ctx context.Context, id influxdb.ID, upd influxdb.LabelUpdate) (*influxdb.Label, error)
UpdateLabel updates a label.
func (*Service) UpdateNotificationEndpoint ¶
func (s *Service) UpdateNotificationEndpoint(ctx context.Context, id influxdb.ID, edp influxdb.NotificationEndpoint, userID influxdb.ID) (influxdb.NotificationEndpoint, error)
UpdateNotificationEndpoint updates a single notification endpoint. Returns the new notification endpoint after update.
func (*Service) UpdateNotificationRule ¶
func (s *Service) UpdateNotificationRule(ctx context.Context, id influxdb.ID, nr influxdb.NotificationRuleCreate, userID influxdb.ID) (influxdb.NotificationRule, error)
UpdateNotificationRule updates a single notification rule. Returns the new notification rule after update.
func (*Service) UpdateOrganization ¶
func (s *Service) UpdateOrganization(ctx context.Context, id influxdb.ID, upd influxdb.OrganizationUpdate) (*influxdb.Organization, error)
UpdateOrganization updates a organization according the parameters set on upd.
func (*Service) UpdateRunState ¶
func (s *Service) UpdateRunState(ctx context.Context, taskID, runID influxdb.ID, when time.Time, state influxdb.RunStatus) error
UpdateRunState sets the run state at the respective time.
func (*Service) UpdateSource ¶
func (s *Service) UpdateSource(ctx context.Context, id influxdb.ID, upd influxdb.SourceUpdate) (*influxdb.Source, error)
UpdateSource updates a source according the parameters set on upd.
func (*Service) UpdateTarget ¶
func (s *Service) UpdateTarget(ctx context.Context, update *influxdb.ScraperTarget, userID influxdb.ID) (*influxdb.ScraperTarget, error)
UpdateTarget updates a scraper target.
func (*Service) UpdateTask ¶
func (s *Service) UpdateTask(ctx context.Context, id influxdb.ID, upd influxdb.TaskUpdate) (*influxdb.Task, error)
UpdateTask updates a single task with changeset.
func (*Service) UpdateTelegrafConfig ¶
func (s *Service) UpdateTelegrafConfig(ctx context.Context, id influxdb.ID, tc *influxdb.TelegrafConfig, userID influxdb.ID) (*influxdb.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 influxdb.ID, upd influxdb.UserUpdate) (*influxdb.User, error)
UpdateUser updates a user according the parameters set on upd.
func (*Service) UpdateVariable ¶
func (s *Service) UpdateVariable(ctx context.Context, id influxdb.ID, update *influxdb.VariableUpdate) (*influxdb.Variable, error)
UpdateVariable updates a single variable in the store with a changeset
func (*Service) WithMaxPermissionFunc ¶
WithMaxPermissionFunc sets the useAuthorizationsForMaxPermissions function which can trigger whether or not max permissions uses the users authorizations to derive maximum permissions.
func (*Service) WithResourceLogger ¶
WithResourceLogger sets the resource audit logger for the service.
func (*Service) WithSpecialOrgBucketIDs ¶
func (s *Service) WithSpecialOrgBucketIDs(gen influxdb.IDGenerator)
WithSpecialOrgBucketIDs sets the generator for the org and bucket ids.
Should only be used in tests for mocking.
type ServiceConfig ¶
ServiceConfig allows us to configure Services
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 // Backup copies all K:Vs to a writer, file format determined by implementation. Backup(ctx context.Context, w io.Writer) error }
Store is an interface for a generic key value store. It is modeled after the boltdb database struct.
type StoreBase ¶
type StoreBase struct { Resource string BktName []byte EncodeEntKeyFn EncodeEntFn EncodeEntBodyFn EncodeEntFn DecodeEntFn DecodeBucketValFn ConvertValToEntFn ConvertValToEntFn }
StoreBase is the base behavior for accessing buckets in kv. It provides mechanisms that can be used in composing stores together (i.e. IndexStore).
func NewOrgNameKeyStore ¶
NewOrgNameKeyStore creates a store for an entity's unique index on organization id and name. This is used throughout the kv pkg here to provide an entity uniquness by name within an org.
func NewStoreBase ¶
func NewStoreBase(resource string, bktName []byte, encKeyFn, encBodyFn EncodeEntFn, decFn DecodeBucketValFn, decToEntFn ConvertValToEntFn) *StoreBase
NewStoreBase creates a new store base.
func (*StoreBase) EntKey ¶
EntKey returns the key for the entity provided. This is a shortcut for grabbing the EntKey without having to juggle the encoding funcs.
func (*StoreBase) Find ¶
Find provides a mechanism for looking through the bucket via the set options. When a prefix is provided, the prefix is used to seek the bucket.
func (*StoreBase) FindEnt ¶
FindEnt returns the decoded entity body via the provided entity. An example entity should not include a Body, but rather the ID, Name, or OrgID.
type Tx ¶
type Tx interface { // Bucket possibly creates and returns bucket, b. Bucket(b []byte) (Bucket, error) // Context returns the context associated with this Tx. Context() context.Context // WithContext associates a context with this Tx. WithContext(ctx context.Context) }
Tx is a transaction in the store.
Source Files ¶
- auth.go
- backup.go
- bucket.go
- check.go
- cursor.go
- dashboard.go
- document.go
- document_options.go
- encode.go
- index.go
- kvlog.go
- label.go
- lookup_service.go
- migration.go
- notification_endpoint.go
- notification_rule.go
- onboarding.go
- org.go
- passwords.go
- scrapers.go
- secret.go
- service.go
- session.go
- source.go
- store.go
- store_base.go
- store_index.go
- task.go
- telegraf.go
- unique.go
- urm.go
- user.go
- variable.go