AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Attributes | List of all members
alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header Struct Reference

#include <BufferLayout.h>

Public Attributes

uint32_t magic
 
uint8_t version
 
uint32_t traitsNameHash
 
uint16_t wordSize
 
uint8_t maxReaders
 
uint8_t maxEphemeralReaders
 
ConditionVariable dataAvailableConditionVariable
 This field contains the condition variable used to notify Readers that data is available. More...
 
Mutex dataAvailableMutex
 This field contains the mutex used by dataAvailableConditionVariable. More...
 
ConditionVariable spaceAvailableConditionVariable
 
Mutex backwardSeekMutex
 
AtomicBool isWriterEnabled
 This field indicates whether there is an enabled (not closed) Writer. More...
 
AtomicBool hasWriterBeenClosed
 This field indicates that a Writer had at one point been enabled and then closed. More...
 
Mutex writerEnableMutex
 
AtomicIndex writeStartCursor
 This field contains the next location to write to. More...
 
AtomicIndex writeEndCursor
 
AtomicIndex oldestUnconsumedCursor
 
uint32_t referenceCount
 This field tracks the number of BufferLayout instances currently attached to a Buffer. More...
 
Mutex attachMutex
 
Mutex readerEnableMutex
 

Detailed Description

template<typename T>
struct alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header

This structure defines the header fields for the Buffer. The header fields in the shared Buffer are the mechanism by which SDS instances in different processes share state. When initializing a new Buffer, this struct must be placement-constructed at the base of the Buffer. When accessing a pre-initialized Buffer, this struct must be reinterpret_cast from the base of the Buffer.

Member Data Documentation

◆ attachMutex

template<typename T >
Mutex alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::attachMutex

This mutex protects attaching/detatching BufferLayout instances to a Buffer. Specifically, it must be held when updating referenceCount, and while cleaning up after referenceCount reaches zero.

◆ backwardSeekMutex

template<typename T >
Mutex alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::backwardSeekMutex

This field contains a mutex used to temporarily hold off Readers from seeking backwards in the buffer while a Reader is updating oldestUnconsumedCursor. The is necessary to prevent a race condition where a Reader::seek() at the same time that a Reader is updating oldestUnconsumedCursor could result in a Reader which is reading from an older Index than oldestUnconsumedCursor.

◆ dataAvailableConditionVariable

template<typename T >
ConditionVariable alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::dataAvailableConditionVariable

This field contains the condition variable used to notify Readers that data is available.

◆ dataAvailableMutex

template<typename T >
Mutex alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::dataAvailableMutex

This field contains the mutex used by dataAvailableConditionVariable.

◆ hasWriterBeenClosed

template<typename T >
AtomicBool alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::hasWriterBeenClosed

This field indicates that a Writer had at one point been enabled and then closed.

◆ isWriterEnabled

template<typename T >
AtomicBool alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::isWriterEnabled

This field indicates whether there is an enabled (not closed) Writer.

◆ magic

template<typename T >
uint32_t alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::magic

This field contains the magic number which is used to identify a valid Header. For a SharedDataStream::buffer to be valid, this field must contain MAGIC_NUMBER.

◆ maxEphemeralReaders

template<typename T >
uint8_t alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::maxEphemeralReaders

This field specifies the maximum number of ephemeral Readers created without specifying an id.

◆ maxReaders

template<typename T >
uint8_t alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::maxReaders

This field specifies the maximum number of Readers.

Note
This value determines the size of the three reader arrays that follow the Header in the Buffer.

◆ oldestUnconsumedCursor

template<typename T >
AtomicIndex alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::oldestUnconsumedCursor

This field contains the location of oldest word in the buffer which has not been consumed (read by a Reader). This field is used as a barrier by Writers which have a policy not to overwrite readers.

◆ readerEnableMutex

template<typename T >
Mutex alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::readerEnableMutex

This mutex is used to protect creation of readers. In particular, it is locked when attempting to add a new reader so that there are no races between overlapping calls to createReader().

◆ referenceCount

template<typename T >
uint32_t alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::referenceCount

This field tracks the number of BufferLayout instances currently attached to a Buffer.

◆ spaceAvailableConditionVariable

template<typename T >
ConditionVariable alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::spaceAvailableConditionVariable

This field contains the condition variable used to notify Writers that space is available. Note that this condition variable does not have a dedicated mutex; the condition is protected by backwardSeekMutex.

◆ traitsNameHash

template<typename T >
uint32_t alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::traitsNameHash

This field contains a stable hash of the T::traitsName string from the SharedDataStream::create() call. For a SharedDataStream to open() a buffer, this field must match the caller's T::traitsName string hash.

◆ version

template<typename T >
uint8_t alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::version

This field specifies the version of the header layout used for the subsequent fields. For a SharedDataStream to use a buffer, this field must match VERSION.

◆ wordSize

template<typename T >
uint16_t alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::wordSize

This field specifies the word size (in bytes). All SharedDataStream operations that work with data or position in the stream are quantified in words.

◆ writeEndCursor

template<typename T >
AtomicIndex alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::writeEndCursor

This field contains the end of the region currently being written to (when no write is in progress, (writEndCursor == writeStartCursor)).

◆ writerEnableMutex

template<typename T >
Mutex alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::writerEnableMutex

This mutex is used to protect creation of the writer. In particular, it is locked when attempting to add the writer so that there are no races between overlapping calls to createWriter().

◆ writeStartCursor

template<typename T >
AtomicIndex alexaClientSDK::avsCommon::utils::sds::SharedDataStream::BufferLayout< T >::Header::writeStartCursor

This field contains the next location to write to.


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

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0