Table of Contents

Interface IResourceReference

Namespace
Acuit.Pinpoint.ResourceManagement
Assembly
Acuit.Pinpoint.ResourceManagement.Abstractions.dll

A resource reference.

public interface IResourceReference : IDisposable
Inherited Members
Extension Methods

Methods

GetChangeToken()

Returns a IChangeToken that can be used to observe when this resource value changes.

IChangeToken GetChangeToken()

Returns

IChangeToken

A IChangeToken.

Remarks

The change token will indicate a change has occurred upon the first completed attempt to retrieve the resource value, whether successful or not; and then subsequently each time the resource value changes.

The returned change token will raise callbacks.

The proper way to ensure all changes are noted is always to call this first to retrieve the change token, before retrieving the resource value via GetValueAsync(CancellationToken).

Exceptions

ObjectDisposedException

The object has been disposed.

GetValueAsync(CancellationToken)

Gets the resource value.

Task<object> GetValueAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token that can be used to request canceling retrieving the resource.

Returns

Task<object>

A task that represents the asynchronous operation. The value of its Result property contains the resource value.

Remarks

In principle, this is meant to always return the current value of the resource, with the underlying resource provider performing whatever logic is necessary to efficiently ensure the latest version is available. Normally, the provider will obtain the resource value asynchronously initially when the first reference for a new resource is created and then transparently update it as necessary as long as there is an active reference to that resource. Thus, when this is called during the initial resource value retrieval, it will complete when that initial resource value retrieval attempt completes. Subsequent calls should generally immediately complete with the last known resource value.

Errors, such as lost connections to a resource, should be reported via the health check system.

The returned resource value may or may not be the same instance as the result of a previous call to retrieve the resource. Callers should treat the returned resource value as read-only.

Exceptions

ObjectDisposedException

The object has been disposed.

Exception

The resource could not be retrieved.