NdsStoreAccessor

class NdsStoreAccessor(storeAccessChangedListenerId: String, initialize: () -> Unit = {}, deinitialize: () -> Unit = {}, cancelRequest: () -> Unit = {}) : OnStoreAccessChangedListener

Takes care of access to a DataStore.

Parameters

initialize

The initialization block that is called when read access is granted. Could be called when registered for updates in NdsStoreAccessSync or when access is granted after being released previously.

deinitialize

The block that should care of deinitialization, because old NdsStoreAccess.handleId is not valid anymore.

cancelRequest

The block is called when access release is requested and long ongoing operations should be cancelled.

Important: This is a Public Preview API. It may be changed or removed at any time.

Constructors

Link copied to clipboard
constructor(storeAccessChangedListenerId: String, initialize: () -> Unit = {}, deinitialize: () -> Unit = {}, cancelRequest: () -> Unit = {})

Properties

Link copied to clipboard

A string that can be used to identify the listener.

Functions

Link copied to clipboard
open override fun onReadOnlyAccessGranted(mapChanged: Boolean)

Notification that read-only (shared) access to the map files was granted to the user.

Link copied to clipboard
open override fun onReadOnlyAccessReleaseRequested(accessReleased: AccessReleasedCallback)

Notification that read-only access to the map is being revoked (usually because the map needs to be updated or otherwise modified).

Link copied to clipboard
fun <T> use(block: () -> T): Result<T, MapIsNotAccessibleFailure>

Allows performing calls when read access is granted. Returns MapIsNotAccessibleFailure if read access is not granted.