Documentation
¶
Overview ¶
Package syncstore stores the latest Management sync response (which carries the network map) for debug bundle generation.
The storage backend is selected at build time per operating system: on iOS the response is serialized to disk to keep it out of the (tightly constrained) process memory, while on all other platforms it is kept in memory. The backend is chosen by the New constructor; see factory_ios.go and factory_other.go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store interface {
// Set stores the given sync response, replacing any previously stored one.
Set(resp *mgmProto.SyncResponse) error
// Get returns the stored sync response, or nil if none is stored.
// The returned value is an independent copy that the caller may retain.
Get() (*mgmProto.SyncResponse, error)
// Clear removes any stored sync response. It is safe to call when nothing
// is stored.
Clear() error
}
Store persists the latest sync response and returns it on demand.
Implementations must be safe for concurrent use.
func New ¶
New returns the platform default store. On all non-iOS platforms the sync response is kept in memory; dir is unused.
func NewDiskStore ¶
NewDiskStore returns a Store that serializes the sync response to a file in the given directory. If dir is empty it falls back to the OS temp directory.
Any file left over from a previous run is removed on construction so a fresh store never reads stale data (e.g. another profile's network map).
func NewMemoryStore ¶
func NewMemoryStore() Store
NewMemoryStore returns a Store that keeps the sync response in memory.