24#ifndef HYRAX_GIT_SUPERCHUNK_H
25#define HYRAX_GIT_SUPERCHUNK_H
48 std::shared_ptr<http::url> d_data_url;
49 std::vector<std::shared_ptr<Chunk>> d_chunks;
50 unsigned long long d_offset;
51 unsigned long long d_size;
55 bool d_uses_fill_value{
false};
57 bool is_contiguous(std::shared_ptr<Chunk> candidate_chunk);
58 void map_chunks_to_buffer();
59 void read_aggregate_bytes();
60 void read_fill_value_chunk();
65 d_id(sc_id), d_parent_array(parent), d_data_url(
nullptr), d_offset(0), d_size(0), d_is_read(
false), d_read_buffer(
nullptr){}
68 delete[] d_read_buffer;
71 virtual std::string id()
const {
return d_id; }
73 virtual bool add_chunk(std::shared_ptr<Chunk> candidate_chunk);
75 std::shared_ptr<http::url> get_data_url() {
return d_data_url; }
76 virtual unsigned long long get_size()
const {
return d_size; }
77 virtual unsigned long long get_offset()
const {
return d_offset; }
84 virtual void read_unconstrained() {
93 virtual bool empty(){
return d_chunks.empty(); }
95 std::vector<std::shared_ptr<Chunk>> get_chunks() {
return d_chunks; }
97 std::string
to_string(
bool verbose)
const;
98 virtual void dump(std::ostream & strm)
const;
106 std::thread::id parent_thread_id;
107 std::string parent_super_chunk_id;
108 std::shared_ptr<Chunk> chunk;
110 const vector<unsigned long long> &array_shape;
113 : parent_thread_id(std::this_thread::get_id()), parent_super_chunk_id(sc_id), chunk(std::move(c)), array(a), array_shape(a_s) {}
122 std::thread::id parent_thread_id;
123 std::string parent_super_chunk_id;
124 std::shared_ptr<Chunk> chunk;
126 const vector<unsigned long long> &array_shape;
127 const vector<unsigned long long> &chunk_shape;
130 const vector<unsigned long long> &c_s)
131 : parent_thread_id(std::this_thread::get_id()), parent_super_chunk_id(sc_id), chunk(std::move(c)),
132 array(a), array_shape(a_s), chunk_shape(c_s) {}
135void process_chunks_concurrent(
136 const string &super_chunk_id,
137 std::queue<shared_ptr<Chunk>> &chunks,
139 const std::vector<unsigned long long> &shape );
141void process_chunks_unconstrained_concurrent(
142 const string &super_chunk_id,
143 std::queue<std::shared_ptr<Chunk>> &chunks,
144 const std::vector<unsigned long long> &chunk_shape,
146 const std::vector<unsigned long long> &array_shape);
Extend libdap::Array so that a handler can read data using a DMR++ file.
A SuperChunk is a collection of contiguous Chunk objects along with optimized methods for data retrie...
virtual void retrieve_data()
Cause the SuperChunk and all of it's subordinate Chunks to be read.
virtual bool add_chunk(std::shared_ptr< Chunk > candidate_chunk)
Attempts to add a new Chunk to this SuperChunk.
std::string to_string(bool verbose) const
Makes a string representation of the SuperChunk.
virtual void dump(std::ostream &strm) const
Writes the to_string() output to the stream strm.
virtual void process_child_chunks()
Reads the SuperChunk, inflates/de-shuffles the subordinate chunks as required and copies the values i...
virtual void process_child_chunks_unconstrained()
Reads the SuperChunk, inflates/deshuffles the subordinate chunks as required and copies the values in...
Single argument structure for a thread that will process a single Chunk for a constrained array....
Single argument structure for a thread that will process a single Chunk for an unconstrained array....