MapDataStoreAccessSyncing
public protocol MapDataStoreAccessSyncing : AnyObject
Describe an interface of the synchronized access to onboard map data.
Important
This is a Public Preview API. It may be changed or removed at any time.-
Registers an observer so it can be informed about changes in map availability. Caller must register their observer in order to get
onReadOnlyAccessGranted
access If the caller does not add an observer read access will not be granted . If the map is already available at the time of calling this,onReadOnlyAccessGranted
will be called immediately, before this call returns. Caller of this function must not hold the same synchronisation primitive (mutex, lock or similar) which will be held inside callbacks inherited from ‘StoreAccessChangedObserver’. Otherwise, a deadlock may occur!Throws
NDSStoreAccessSync.SyncErrorinvalidObserverError
upon adding the same observer more than once.Declaration
Swift
func addObserver(_ observer: StoreAccessChangedObserver) throws
Parameters
observer
observer to add.
-
Unregisters an observer (if it was previously registered by
addObserver
).After this function returns, it is guaranteed that no more callbacks will be received by this observer.
Caller of this function must not hold the same synchronisation primitive (mutex, lock or similar) which will be held inside callbacks inherited from ‘StoreAccessChangedObserver’. Otherwise, a deadlock may occur!
Declaration
Swift
func removeObserver(_ observer: StoreAccessChangedObserver)
Parameters
observer
observer to remove.
-
Request to obtain write access (in addition to read access) to the map for the given observer. Upon calling this, all other currently registered observers will be asked to release read-only access (via
onReadOnlyAccessReleaseRequested
) and this call will block until they do so or the time runs out (see: ‘timeout’ parameter).Throws
NDSStoreAccessSync.SyncError.InvalidObserverError
upon attempting to request write access for a observer that wasn’t previously added viaaddObserver
.Declaration
Swift
func requestWriteAccess(observer: StoreAccessChangedObserver, timeout: TimeInterval) throws -> WriteAccessStatus
Parameters
observer
Observer which will be granted write access if the call is successful.
timeout
Maximum time to wait.
Return Value
WriteAccessStatus
.granted
if the request was successful,.timedOut
if the time ran out, or.grantedToAnother
if the request was cancelled because a different observer already has write access. -
Release write access previously obtained by
requestWriteAccess
(and return to read-only).Throws
NDSStoreAccessSync.SyncError.InvalidObserverError
upon attempting to release write access for a observer that wasn’t previously added viaaddObserver
or didn’t previously obtain write access viarequestWriteAccess
.Declaration
Swift
func releaseWriteAccess(observer: StoreAccessChangedObserver) throws
Parameters
observer
observer that currently has write access to the map.