Documentation ¶
Index ¶
- Constants
- type Mongo
- func (m *Mongo) AcquireInstanceLock(ctx context.Context, instanceID string) (lockID string, err error)
- func (m *Mongo) AddEventToInstance(ctx context.Context, currentInstance *models.Instance, event *models.Event, ...) (newETag string, err error)
- func (m *Mongo) AddInstance(ctx context.Context, instance *models.Instance) (inst *models.Instance, err error)
- func (m *Mongo) CheckDatasetExists(ctx context.Context, id, state string) error
- func (m *Mongo) CheckEditionExists(ctx context.Context, id, editionID, state string) error
- func (m *Mongo) Checker(ctx context.Context, state *healthcheck.CheckState) error
- func (m *Mongo) Close(ctx context.Context) error
- func (m *Mongo) DeleteDataset(ctx context.Context, id string) (err error)
- func (m *Mongo) DeleteEdition(ctx context.Context, id string) (err error)
- func (m *Mongo) GetDataset(ctx context.Context, id string) (*models.DatasetUpdate, error)
- func (m *Mongo) GetDatasets(ctx context.Context, offset, limit int, authorised bool) (values []*models.DatasetUpdate, totalCount int, err error)
- func (m *Mongo) GetDatasetsByBasedOn(ctx context.Context, id string, offset, limit int, authorised bool) (values []*models.DatasetUpdate, totalCount int, err error)
- func (m *Mongo) GetDimensionOptions(ctx context.Context, version *models.Version, dimension string, ...) ([]*models.PublicDimensionOption, int, error)
- func (m *Mongo) GetDimensionOptionsFromIDs(ctx context.Context, version *models.Version, dimension string, ids []string) ([]*models.PublicDimensionOption, int, error)
- func (m *Mongo) GetDimensions(ctx context.Context, versionID string) ([]bson.M, error)
- func (m *Mongo) GetDimensionsFromInstance(ctx context.Context, id string, offset, limit int) ([]*models.DimensionOption, int, error)
- func (m *Mongo) GetEdition(ctx context.Context, id, editionID, state string) (*models.EditionUpdate, error)
- func (m *Mongo) GetEditions(ctx context.Context, id, state string, offset, limit int, authorised bool) ([]*models.EditionUpdate, int, error)
- func (m *Mongo) GetInstance(ctx context.Context, id, eTagSelector string) (*models.Instance, error)
- func (m *Mongo) GetInstances(ctx context.Context, states, datasets []string, offset, limit int) ([]*models.Instance, int, error)
- func (m *Mongo) GetNextVersion(ctx context.Context, datasetID, edition string) (int, error)
- func (m *Mongo) GetUniqueDimensionAndOptions(ctx context.Context, id, dimension string) (uniqueValues []*string, countOfValues int, err error)
- func (m *Mongo) GetVersion(ctx context.Context, id, editionID string, versionID int, state string) (*models.Version, error)
- func (m *Mongo) GetVersions(ctx context.Context, datasetID, editionID, state string, offset, limit int) ([]models.Version, int, error)
- func (m *Mongo) Init(ctx context.Context) (err error)
- func (m *Mongo) RemoveDatasetVersionAndEditionLinks(ctx context.Context, id string) error
- func (m *Mongo) UnlockInstance(ctx context.Context, lockID string)
- func (m *Mongo) UpdateBuildHierarchyTaskState(ctx context.Context, currentInstance *models.Instance, ...) (newETag string, err error)
- func (m *Mongo) UpdateBuildSearchTaskState(ctx context.Context, currentInstance *models.Instance, ...) (newETag string, err error)
- func (m *Mongo) UpdateDataset(ctx context.Context, id string, dataset *models.Dataset, currentState string) (err error)
- func (m *Mongo) UpdateDatasetWithAssociation(ctx context.Context, id, state string, version *models.Version) (err error)
- func (m *Mongo) UpdateDimensionsNodeIDAndOrder(ctx context.Context, dimensions []*models.DimensionOption) error
- func (m *Mongo) UpdateETagForOptions(ctx context.Context, currentInstance *models.Instance, ...) (newETag string, err error)
- func (m *Mongo) UpdateImportObservationsTaskState(ctx context.Context, currentInstance *models.Instance, ...) (newETag string, err error)
- func (m *Mongo) UpdateInstance(ctx context.Context, currentInstance, updatedInstance *models.Instance, ...) (newETag string, err error)
- func (m *Mongo) UpdateMetadata(ctx context.Context, datasetID, versionID, versionEtag string, ...) error
- func (m *Mongo) UpdateObservationInserted(ctx context.Context, currentInstance *models.Instance, ...) (newETag string, err error)
- func (m *Mongo) UpdateVersion(ctx context.Context, currentVersion, versionUpdate *models.Version, ...) (newETag string, err error)
- func (m *Mongo) UpsertContact(ctx context.Context, id string, update interface{}) (err error)
- func (m *Mongo) UpsertDataset(ctx context.Context, id string, datasetDoc *models.DatasetUpdate) (err error)
- func (m *Mongo) UpsertDimensionsToInstance(ctx context.Context, opts []*models.CachedDimensionOption) error
- func (m *Mongo) UpsertEdition(ctx context.Context, datasetID, edition string, ...) (err error)
- func (m *Mongo) UpsertVersion(ctx context.Context, id string, version *models.Version) (err error)
Constants ¶
const AnyETag = "*"
AnyETag represents the wildchar that corresponds to not check the ETag value for update requests
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mongo ¶
type Mongo struct { config.MongoConfig Connection *mongodriver.MongoConnection // contains filtered or unexported fields }
func (*Mongo) AcquireInstanceLock ¶ added in v1.34.0
func (m *Mongo) AcquireInstanceLock(ctx context.Context, instanceID string) (lockID string, err error)
AcquireInstanceLock tries to lock the provided instanceID. If the instance is already locked, this function will block until it's released, at which point we acquire the lock and return.
func (*Mongo) AddEventToInstance ¶
func (m *Mongo) AddEventToInstance(ctx context.Context, currentInstance *models.Instance, event *models.Event, eTagSelector string) (newETag string, err error)
AddEventToInstance to the instance collection
func (*Mongo) AddInstance ¶
func (m *Mongo) AddInstance(ctx context.Context, instance *models.Instance) (inst *models.Instance, err error)
AddInstance to the instance collection
func (*Mongo) CheckDatasetExists ¶
CheckDatasetExists checks that the dataset exists
func (*Mongo) CheckEditionExists ¶
CheckEditionExists checks that the edition of a dataset exists
func (*Mongo) Checker ¶ added in v1.22.0
func (m *Mongo) Checker(ctx context.Context, state *healthcheck.CheckState) error
Checker is called by the healthcheck library to check the health state of this mongoDB instance
func (*Mongo) Close ¶ added in v1.22.0
Close represents mongo session closing within the context deadline
func (*Mongo) DeleteDataset ¶
DeleteDataset deletes an existing dataset document
func (*Mongo) DeleteEdition ¶
DeleteEdition deletes an existing edition document
func (*Mongo) GetDataset ¶
GetDataset retrieves a dataset document
func (*Mongo) GetDatasets ¶
func (m *Mongo) GetDatasets(ctx context.Context, offset, limit int, authorised bool) (values []*models.DatasetUpdate, totalCount int, err error)
GetDatasets retrieves all dataset documents
func (*Mongo) GetDatasetsByBasedOn ¶ added in v1.44.0
func (m *Mongo) GetDatasetsByBasedOn(ctx context.Context, id string, offset, limit int, authorised bool) (values []*models.DatasetUpdate, totalCount int, err error)
GetDatasetsByBasedOn checks Published...... TODO: FINISH Filter condition checks for ... .TODO: FINISH
func (*Mongo) GetDimensionOptions ¶
func (m *Mongo) GetDimensionOptions(ctx context.Context, version *models.Version, dimension string, offset, limit int) ([]*models.PublicDimensionOption, int, error)
GetDimensionOptions returns dimension options for a dimensions within a dataset, according to the provided limit and offset. Offset and limit need to be positive or zero
func (*Mongo) GetDimensionOptionsFromIDs ¶ added in v1.25.0
func (m *Mongo) GetDimensionOptionsFromIDs(ctx context.Context, version *models.Version, dimension string, ids []string) ([]*models.PublicDimensionOption, int, error)
GetDimensionOptionsFromIDs returns dimension options for a dimension within a dataset, whose IDs match the provided list of IDs
func (*Mongo) GetDimensions ¶
GetDimensions returns a list of all dimensions from a dataset
func (*Mongo) GetDimensionsFromInstance ¶
func (m *Mongo) GetDimensionsFromInstance(ctx context.Context, id string, offset, limit int) ([]*models.DimensionOption, int, error)
GetDimensionsFromInstance returns a list of dimensions and their options for an instance resource. Note that all dimension options for all dimensions are returned as high level items, hence there can be duplicate dimension names, which correspond to different options.
func (*Mongo) GetEdition ¶
func (m *Mongo) GetEdition(ctx context.Context, id, editionID, state string) (*models.EditionUpdate, error)
GetEdition retrieves an edition document for a dataset
func (*Mongo) GetEditions ¶
func (m *Mongo) GetEditions(ctx context.Context, id, state string, offset, limit int, authorised bool) ([]*models.EditionUpdate, int, error)
GetEditions retrieves all edition documents for a dataset
func (*Mongo) GetInstance ¶
GetInstance returns a single instance from an ID
func (*Mongo) GetInstances ¶
func (m *Mongo) GetInstances(ctx context.Context, states, datasets []string, offset, limit int) ([]*models.Instance, int, error)
GetInstances from a mongo collection
func (*Mongo) GetNextVersion ¶
GetNextVersion retrieves the latest version for an edition of a dataset
func (*Mongo) GetUniqueDimensionAndOptions ¶
func (m *Mongo) GetUniqueDimensionAndOptions(ctx context.Context, id, dimension string) (uniqueValues []*string, countOfValues int, err error)
GetUniqueDimensionAndOptions returns a list of dimension options for an instance resource
func (*Mongo) GetVersion ¶
func (m *Mongo) GetVersion(ctx context.Context, id, editionID string, versionID int, state string) (*models.Version, error)
GetVersion retrieves a version document for a dataset edition
func (*Mongo) GetVersions ¶
func (m *Mongo) GetVersions(ctx context.Context, datasetID, editionID, state string, offset, limit int) ([]models.Version, int, error)
GetVersions retrieves all version documents for a dataset edition
func (*Mongo) Init ¶
Init returns an initialised Mongo object encapsulating a connection to the mongo server/cluster with the given configuration, a health client to check the health of the mongo server/cluster, and a lock client
func (*Mongo) RemoveDatasetVersionAndEditionLinks ¶ added in v1.38.0
func (*Mongo) UnlockInstance ¶ added in v1.34.0
UnlockInstance releases an exclusive mongoDB lock for the provided lockId (if it exists)
func (*Mongo) UpdateBuildHierarchyTaskState ¶
func (m *Mongo) UpdateBuildHierarchyTaskState(ctx context.Context, currentInstance *models.Instance, dimension, state, eTagSelector string) (newETag string, err error)
UpdateBuildHierarchyTaskState updates the state of a build hierarchy task.
func (*Mongo) UpdateBuildSearchTaskState ¶
func (m *Mongo) UpdateBuildSearchTaskState(ctx context.Context, currentInstance *models.Instance, dimension, state, eTagSelector string) (newETag string, err error)
UpdateBuildSearchTaskState updates the state of a build search task.
func (*Mongo) UpdateDataset ¶
func (m *Mongo) UpdateDataset(ctx context.Context, id string, dataset *models.Dataset, currentState string) (err error)
UpdateDataset updates an existing dataset document
func (*Mongo) UpdateDatasetWithAssociation ¶
func (m *Mongo) UpdateDatasetWithAssociation(ctx context.Context, id, state string, version *models.Version) (err error)
UpdateDatasetWithAssociation updates an existing dataset document with collection data
func (*Mongo) UpdateDimensionsNodeIDAndOrder ¶ added in v1.37.0
func (m *Mongo) UpdateDimensionsNodeIDAndOrder(ctx context.Context, dimensions []*models.DimensionOption) error
UpdateDimensionsNodeIDAndOrder to cache the id and order (optional) for other import processes
func (*Mongo) UpdateETagForOptions ¶ added in v1.34.0
func (m *Mongo) UpdateETagForOptions(ctx context.Context, currentInstance *models.Instance, upserts []*models.CachedDimensionOption, updates []*models.DimensionOption, eTagSelector string) (newETag string, err error)
UpdateETagForOptions updates the eTag value for an instance according to the provided dimension options upserts and updates
func (*Mongo) UpdateImportObservationsTaskState ¶
func (m *Mongo) UpdateImportObservationsTaskState(ctx context.Context, currentInstance *models.Instance, state, eTagSelector string) (newETag string, err error)
UpdateImportObservationsTaskState to the given state.
func (*Mongo) UpdateInstance ¶
func (m *Mongo) UpdateInstance(ctx context.Context, currentInstance, updatedInstance *models.Instance, eTagSelector string) (newETag string, err error)
UpdateInstance with new properties
func (*Mongo) UpdateMetadata ¶ added in v1.56.0
func (*Mongo) UpdateObservationInserted ¶
func (m *Mongo) UpdateObservationInserted(ctx context.Context, currentInstance *models.Instance, observationInserted int64, eTagSelector string) (newETag string, err error)
UpdateObservationInserted by incrementing the stored value
func (*Mongo) UpdateVersion ¶
func (m *Mongo) UpdateVersion(ctx context.Context, currentVersion, versionUpdate *models.Version, eTagSelector string) (newETag string, err error)
UpdateVersion updates an existing version document
func (*Mongo) UpsertContact ¶
UpsertContact adds or overrides an existing contact document
func (*Mongo) UpsertDataset ¶
func (m *Mongo) UpsertDataset(ctx context.Context, id string, datasetDoc *models.DatasetUpdate) (err error)
UpsertDataset adds or overrides an existing dataset document
func (*Mongo) UpsertDimensionsToInstance ¶ added in v1.36.0
func (m *Mongo) UpsertDimensionsToInstance(ctx context.Context, opts []*models.CachedDimensionOption) error
UpsertDimensionsToInstance to the dimension collection
func (*Mongo) UpsertEdition ¶
func (m *Mongo) UpsertEdition(ctx context.Context, datasetID, edition string, editionDoc *models.EditionUpdate) (err error)
UpsertEdition adds or overrides an existing edition document