|
YAACC - UPNP Client and Server
|
Keeps the per-install marker of YAACC's Snapcast stream name (YAACC <phone name> <marker>) in a preferences file of its own, private to the app (and outside every backup: the manifest turns them off).
More...


Classes | |
| interface | Storage |
| A string in a place that survives restarts; the app uses a private preferences file. More... | |
Public Member Functions | |
| String | loadOrCreate (java.util.function.Supplier< String > maker) |
| Returns the stored marker or makes the first one, atomically in this process: the workers of two servers that start at the same moment on the first use ever get the same marker, and only one value is ever written. | |
| String | load () |
| void | save (String marker) |
| Stores the marker. | |
Public Member Functions inherited from de.yaacc.snapcast.feed.SnapcastStreams.MarkerStore | |
Static Public Member Functions | |
| static SnapcastMarkerStore | forContext (Context context) |
| The marker in the private preferences of the app. | |
Keeps the per-install marker of YAACC's Snapcast stream name (YAACC <phone name> <marker>) in a preferences file of its own, private to the app (and outside every backup: the manifest turns them off).
The marker is 8 random lower-case hex characters made by SnapcastStreams from a SecureRandom; it is never derived from the Android id, a serial number, a MAC address or the UPnP UDN. It is an identifier that every controller of the server can read in the stream name, not a secret.
Loading is strict: anything that is not exactly 8 characters of 0-9a-f counts as "nothing stored" (a new marker is made then), so a changed or damaged file can never put anything else into a stream name or a URI. Saving refuses the same.
| String de.yaacc.snapcast.SnapcastMarkerStore.load | ( | ) |
Implements de.yaacc.snapcast.feed.SnapcastStreams.MarkerStore.
Referenced by de.yaacc.snapcast.SnapcastMarkerStore.loadOrCreate().

| String de.yaacc.snapcast.SnapcastMarkerStore.loadOrCreate | ( | java.util.function.Supplier< String > | maker | ) |
Returns the stored marker or makes the first one, atomically in this process: the workers of two servers that start at the same moment on the first use ever get the same marker, and only one value is ever written.
The value is committed with apply, which updates the in-memory preferences at once, so the next reader in the lock sees it.
Implements de.yaacc.snapcast.feed.SnapcastStreams.MarkerStore.

| void de.yaacc.snapcast.SnapcastMarkerStore.save | ( | String | marker | ) |
Stores the marker.
Implements de.yaacc.snapcast.feed.SnapcastStreams.MarkerStore.
Referenced by de.yaacc.snapcast.SnapcastMarkerStore.loadOrCreate().
