acl/decompression/database/database.h¶
#include "acl/decompression/database/database.h"
The database context that decompression uses with a compressed database.
database_stream_request_result¶
enum class database_stream_request_result
{
done,
dispatched,
streaming_in_progress,
context_not_initialized,
invalid_database_tier,
no_free_streaming_requests,
};
Encapsulates the possible streaming request results.
| Value | Description |
|---|---|
done |
Streaming is done for the requested tier. |
dispatched |
The streaming request has been dispatched. |
streaming_in_progress |
The streaming request has been ignored because streaming is already in progress. |
context_not_initialized |
The database context isn't initialized. |
invalid_database_tier |
Invalid database tier specified. |
no_free_streaming_requests |
Ran out of streaming requests. |
database_context¶
template<class database_settings_type>
class database_context
Database decompression context for the uniformly sampled algorithm. The context allows various streaming actions to be performed on the database.
Both the constructor and destructor are public because it is safe to place instances of this context on the stack or as member variables.
Note that the context only manages the streaming bookkeeping, the actual IO is handled by the database_streamer implementation provided.
database_context::settings_type¶
using settings_type = database_settings_type;
An alias to the database settings type.
database_context::database_context¶
database_context()
Constructs a context instance.
database_context::~database_context¶
~database_context()
Destructs a context instance.
database_context::get_compressed_database¶
const compressed_database* get_compressed_database() const
Returns the compressed database bound to this context instance.
database_context::initialize¶
bool initialize(iallocator& allocator, const compressed_database& database)
Initializes the context instance to a particular compressed database instance. No streaming can be performed and it is assumed that all the data is present in memory. Returns whether initialization was successful or not.
bool initialize(
iallocator& allocator,
const compressed_database& database,
database_streamer& medium_tier_streamer,
database_streamer& low_tier_streamer)
Initializes the context instance to a particular compressed database instance. The streamer instances will be used to issue IO stream in/out requests. If a tier is stripped, the null_database_streamer can be used. Returns whether initialization was successful or not.
database_context::is_initialized¶
bool is_initialized() const
Returns true if this context instance is bound to a compressed database instance, false otherwise.
database_context::reset¶
void reset()
Resets the context instance to its default constructed state. If the context was currently bound to a database instance, it will no longer be bound to it.
database_context::relocated¶
bool relocated(const compressed_database& database)
If the bound compressed database instance has relocated elsewhere in memory, this function rebinds the context to it, avoiding the need to re-initialize it entirely. Returns whether rebinding was successful or not.
bool relocated(
const compressed_database& database,
database_streamer& medium_tier_streamer,
database_streamer& low_tier_streamer)
If the bound compressed database instance has relocated elsewhere in memory, this function rebinds the context to it, avoiding the need to re-initialize it entirely. This can also be called if the streamers relocated, it will cause them to be rebound as well. Assumes that the streamers have retained the same bulk data state as well. If it is not the case, reset and re-initialize the context. Returns whether rebinding was successful or not.
database_context::is_bound_to¶
bool is_bound_to(const compressed_database& database) const
Returns true if this context instance is bound to the specified database instance, false otherwise.
database_context::contains¶
bool contains(const compressed_tracks& tracks) const
Returns whether the database bound contains the provided compressed tracks instance data.
database_context::is_streamed_in¶
bool is_streamed_in(quality_tier tier) const
Returns whether or not we have streamed in any of the database bulk data for the specified tier (medium or low).
database_context::is_streaming¶
bool is_streaming(quality_tier tier) const
Returns whether or not a streaming request is in flight for the specified tier (medium or low).
database_context::stream_in¶
database_stream_request_result stream_in(
quality_tier tier,
uint32_t num_chunks_to_stream = ~0U)
Issues a stream in request and returns the current status for the specified tier (medium or low). By default, every chunk will be streamed in but they can be streamed progressively by providing a number of chunks.
database_context::stream_out¶
database_stream_request_result stream_out(
quality_tier tier,
uint32_t num_chunks_to_stream = ~0U)
Issues a stream out request and returns the current status for the specified tier (medium or low). By default, every chunk will be streamed out but they can be streamed progressively by providing a number of chunks.