#include <SegmentEntityStore.h>
SegmentEntityStore segments and child entities partitioned by segment id for rapid addressing https://github.com/xjmusic/xjmusic/issues/276
XJ Lab Distributed Architecture https://github.com/xjmusic/xjmusic/issues/207 Chains, ChainBindings, TemplateConfigs, Segments and all Segment content sub-entities persisted in JSON:API record stored keyed by chain or segment id in memory
◆ SegmentEntityStore()
XJ::SegmentEntityStore::SegmentEntityStore |
( |
| ) |
|
|
default |
◆ clear()
void SegmentEntityStore::clear |
( |
| ) |
|
Delete all records in the store (e.g. during integration testing) @ on failure
◆ deleteChain()
void SegmentEntityStore::deleteChain |
( |
| ) |
|
◆ deleteSegment()
void SegmentEntityStore::deleteSegment |
( |
int |
id | ) |
|
◆ deleteSegmentsAfter()
void SegmentEntityStore::deleteSegmentsAfter |
( |
int |
lastSegmentId | ) |
|
Delete all segments after the given segment id
- Parameters
-
◆ deleteSegmentsBefore()
void SegmentEntityStore::deleteSegmentsBefore |
( |
int |
lastSegmentId | ) |
|
Delete all segments before the given segment id
- Parameters
-
◆ empty()
bool SegmentEntityStore::empty |
( |
| ) |
const |
Whether the segment manager is completely empty
- Returns
- true if there are zero segments
◆ getSegmentCount()
int SegmentEntityStore::getSegmentCount |
( |
| ) |
const |
Get the total number of segments in the store
- Returns
- number of segments
◆ onlyAllowSegmentStateTransitions()
Require state is in an array of states
- Parameters
-
toState | to check |
allowedStates | required to be in @ if not in required states |
◆ protectSegmentStateTransition()
Segment state transitions are protected, dependent on the state this segment is being transitioned of, and the intended state it is being transitioned to.
- Parameters
-
fromState | to protect transition of |
toState | to test transition to @ on prohibited transition |
◆ put() [1/2]
Chain * SegmentEntityStore::put |
( |
const Chain & |
c | ) |
|
Put the Chain in the entity store
- Returns
- stored Chain
◆ put() [2/2]
◆ readAllSegmentChoiceArrangementPicks() [1/2]
Read all arrangement picks for the given segment choice
- Parameters
-
- Returns
◆ readAllSegmentChoiceArrangementPicks() [2/2]
Read all choices for the set of segments
- Parameters
-
- Returns
- list of choices
◆ readAllSegmentEntities()
std::set< const SegmentEntity * > SegmentEntityStore::readAllSegmentEntities |
( |
const std::set< int > & |
segmentIds | ) |
|
Read all sub-entities records for many parent segments by id
- Parameters
-
segmentIds | for which to read records. |
- Returns
- collection of all sub entities of these parent segments, different classes that extend EntityUtils
◆ readAllSegments()
std::vector< const Segment * > SegmentEntityStore::readAllSegments |
( |
| ) |
|
Get all segments for a chain id
- Returns
- collection of segments @ on failure to retrieve the requested key
◆ readAllSegmentsInState()
Get all segments for a chain id in a given state
- Parameters
-
- Returns
- collection of segments
- Exceptions
-
exception | on failure to retrieve the requested key |
◆ readAllSegmentsSpanning()
std::vector< const Segment * > SegmentEntityStore::readAllSegmentsSpanning |
( |
const unsigned long long int |
fromChainMicros, |
|
|
const unsigned long long int |
toChainMicros |
|
) |
| |
Get the segments that span the given instant
- Parameters
-
fromChainMicros | for which to get segments |
toChainMicros | for which to get segments |
- Returns
- segments that span the given instant, empty if none found
◆ readChain()
std::optional< Chain * > SegmentEntityStore::readChain |
( |
| ) |
|
◆ readChoice()
Read a choice for a given segment id and program type
- Parameters
-
segmentId | for which to get choice |
programType | to get |
- Returns
- main choice
◆ readChoiceHash()
std::string SegmentEntityStore::readChoiceHash |
( |
const Segment & |
segment | ) |
|
Get a hash of all the choices for the given segment
- Parameters
-
segment | for which to get the choice hash |
- Returns
- hash of all the ids of the choices for the given segment
◆ readLastSegmentId()
int SegmentEntityStore::readLastSegmentId |
( |
| ) |
const |
Get the last known segment id
- Returns
- last segment id
◆ readOrderedSegmentChords()
std::vector< const SegmentChord * > SegmentEntityStore::readOrderedSegmentChords |
( |
int |
segmentId | ) |
|
Read all segment chords in order of position for the given segmefnt
- Parameters
-
segmentId | for which to get chords |
- Returns
- chords
◆ readSegment()
std::optional< const Segment * > SegmentEntityStore::readSegment |
( |
int |
segmentId | ) |
|
◆ readSegmentAtChainMicros()
std::optional< const Segment * > SegmentEntityStore::readSegmentAtChainMicros |
( |
const unsigned long long int |
chainMicros | ) |
|
Get the segment at the given chain microseconds, if it is ready segment beginning <= chain microseconds <= end
Note this algorithm intends to get the latter segment when the lookup point is on the line between two segments
- Parameters
-
chainMicros | the chain microseconds for which to get the segment |
- Returns
- the segment at the given chain microseconds, or an empty optional if the segment is not ready
◆ readSegmentLast()
std::optional< const Segment * > SegmentEntityStore::readSegmentLast |
( |
| ) |
|
Read the last segment in a Chain, Segments sorted by offset ascending
- Returns
- Last Segment in Chain
◆ readSegmentsFromToOffset()
std::vector< const Segment * > SegmentEntityStore::readSegmentsFromToOffset |
( |
int |
fromOffset, |
|
|
int |
toOffset |
|
) |
| |
Read all Segments that are accessible, by Chain ID, starting and ending at particular offsets
- Parameters
-
fromOffset | to read segments form |
toOffset | to read segments to |
- Returns
- list of segments as JSON
◆ SEGMENT_STORE_CORE_HEADERS()
XJ::SegmentEntityStore::SEGMENT_STORE_CORE_HEADERS |
( |
SegmentMeta |
, |
|
|
SegmentMetas |
|
|
) |
| |
◆ updateSegment()
const Segment * SegmentEntityStore::updateSegment |
( |
Segment & |
segment | ) |
|
The documentation for this class was generated from the following files: