OnStoreAccessChangedObserver
public protocol OnStoreAccessChangedObserver : Observer
Interface for components that rely on the onboard map. It is used to synchronise access/unavailability states for map files.
It is expected that every user which reads or modifies the map implements
this interface and register itself for notification in the NDSStoreAccessSync
.
Important
This is a Public Preview API. It may be changed or removed at any time.-
A string that can be used to identify the observer.
This will be used only for logging purposes, so there are no strict rules on what it should look like, but a descriptive and unique name would be best for log readability.
Declaration
Swift
var onStoreAccessChangedObserverId: String { get }
-
Notification that read-only (shared) access to the map files was granted to the user.
This notification is received when the observer is registered to
NDSStoreAccessSync
, if the map is available at that time, and also every time the map becomes available again (typically, after a component with write access finishes modifying the map and reverts to read-only access). Upon receiving this notification, the observer should initialize/reset their internal state that depends on map data, in all cases except one: when their map-dependent internal state is already initialized ANDmapChanged
is equal to false.A user with read-only access must not modify the map files in any way!
Declaration
Swift
func onReadOnlyAccessGranted(mapChanged: Bool)
Parameters
mapChanged
true
if the map was modified since the last call toonReadOnlyAccessReleaseRequested
andfalse
otherwise. -
Notification that read-only access to the map is being revoked (usually because the map needs to be updated or otherwise modified).
The observer should stop all operations which access the map and invoke the callback provided as the first parameter to signal it has done so (and after invoking it, it no longer has any kind of access to the map!). If it is not possible to stop any ongoing operations, the observer can save the callback and call it later, after its operations have finished (unless it receives
onReadOnlyAccessGranted
in the meantime, which means that shared access is no longer being revoked).In either case, the implementation of
onReadOnlyAccessReleaseRequested
should return as quickly as possible and not stall.Declaration
Swift
func onReadOnlyAccessReleaseRequested(accessReleased: @escaping AccessReleaseCallback)
Parameters
accessReleased
a function or function-like object which should be called by the user after it stops accessing the map files to signal that it has released access to the map.