Class AtomicUpdateUtils
Utility methods for performing atomic updates against FDM.
Inherited Members
Namespace: Cognite.Extensions.DataModels
Assembly: Cognite.Extensions.dll
Syntax
public static class AtomicUpdateUtils
Methods
| Edit this page View SourceUpsertAtomic<T>(DataModelsResource, IEnumerable<string>, string, InstanceType, IEnumerable<InstanceSource>, Func<IEnumerable<BaseInstance<T>>, IEnumerable<BaseInstanceWrite>>, CancellationToken, int)
Upsert a list of up to 1000 items atomically.
Declaration
public static Task<IEnumerable<SlimInstance>> UpsertAtomic<T>(this DataModelsResource resource, IEnumerable<string> externalIds, string space, InstanceType instanceType, IEnumerable<InstanceSource> sources, Func<IEnumerable<BaseInstance<T>>, IEnumerable<BaseInstanceWrite>> updateAction, CancellationToken token, int maxRetries = 10)
Parameters
| Type | Name | Description |
|---|---|---|
| DataModelsResource | resource | Data models resouce |
| IEnumerable<string> | externalIds | ExternalIDs of instances to upsert |
| string | space | Space of given externalIds |
| InstanceType | instanceType | Instance type to upsert |
| IEnumerable<InstanceSource> | sources | Which sources to retrieve data for. |
| Func<IEnumerable<BaseInstance<T>>, IEnumerable<BaseInstanceWrite>> | updateAction | Action called once for each upsert attempt, should create a write by updating the given instances. May be called multiple times if the upsert fails with a conflict. |
| CancellationToken | token | Cancellation token |
| int | maxRetries | Maximum number of retries before giving up, can be set to -1 to retry forever. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<SlimInstance>> | Updated instances |
Type Parameters
| Name | Description |
|---|---|
| T | Type of data to retrieve |