YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.snapcast.SnapcastMarkerStore Class Reference

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...

Inheritance diagram for de.yaacc.snapcast.SnapcastMarkerStore:
Inheritance graph
Collaboration diagram for de.yaacc.snapcast.SnapcastMarkerStore:
Collaboration graph

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.
 

Detailed Description

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.

Member Function Documentation

◆ load()

String de.yaacc.snapcast.SnapcastMarkerStore.load ( )
Returns
the stored marker, or null if there is none

Implements de.yaacc.snapcast.feed.SnapcastStreams.MarkerStore.

Referenced by de.yaacc.snapcast.SnapcastMarkerStore.loadOrCreate().

Here is the caller graph for this function:

◆ 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.

Here is the call graph for this function:

◆ save()

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().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: