Folly's observer library.

Types

Name

Description

AtomicObserver

An AtomicObserver provides read‐optimized caching for an Observer using std::atomic. Reading only requires atomic loads unless the cached value is stale. If the cache needs to be refreshed, a mutex is used to synchronize the update. This avoids creating a shared_ptr for every read.

CallbackHandle

Owns a callback subscription to an Observer.

CoreCachedObserver

A read‐optimized observer that caches an observer's snapshot with core‐local sharing.

HazptrObserver

HazptrObserver implements a read‐optimized Observer which caches an Observer's snapshot and protects access to it using hazptrs. The cached snapshot is kept up to date using a callback which fires when the original observer changes. This implementation incurs an additional allocation on updates making it less suitable for write‐heavy workloads.

ObservableTraits

Default traits describing how to read from and subscribe to an observable.

Observer

Observer ‐ a library which lets you create objects which track updates of their dependencies and get re‐computed when any of the dependencies changes.

ObserverCreator

Creates an Observer from an observable using the given traits.

ObserverTraits

Maps a value type to the observer type used to cache it.

ReadMostlyAtomicObserver

A ReadMostlyAtomicObserver guarantees that reading is exactly one relaxed atomic load and a read from a thread local bool. Like AtomicObserver, the value is cached using std::atomic. However, there is no version check when reading which means that the cached value may be out‐of‐date with the Observer value. The cached value will be updated asynchronously in a background thread.

ReadMostlyTLObserver

A TLObserver that optimizes for getting a shared_ptr‐like pointer to data.

SimpleObservable

An observable whose value is set manually and read through an Observer.

Snapshot

A stable view of an observed value at a point in time.

TLObserver

A TLObserver provides read‐optimized caching for an Observer using thread‐local storage. This avoids creating a shared_ptr for every read.

Type Aliases

Name

Description

ObserverT

Alias for the observer type selected by ObserverTraits.

Functions

Name

Description

makeAtomicObserver

makeAtomicObserver overloads

makeCoreCachedObserver

makeCoreCachedObserver overloads

makeHazptrObserver

makeHazptrObserver overloads

makeObserver

makeObserver overloads

makeReadMostlyAtomicObserver

makeReadMostlyAtomicObserver overloads

makeReadMostlyTLObserver

makeReadMostlyTLObserver overloads

makeStaticObserver

makeStaticObserver overloads

makeTLObserver

makeTLObserver overloads

makeValueObserver

makeValueObserver overloads

unwrap

unwrap overloads

unwrapValue

unwrapValue overloads

withJitter

The returned Observer will proxy updates from the input observer but will delay the propagation of each update by some duration between 0 ms and lag + jitter. In addition, if an update arrives while no preceding jittered updates are still in flight, then the delay applied to the latest update will be a uniformly random duration between lag ‐ jitter and lag + jitter.

Created with MrDocs