MCPcopy Create free account
hub / github.com/ImageEngine/cortex / commitNodeToSubIndex

Method commitNodeToSubIndex

src/IECore/StreamIndexedIO.cpp:2607–2640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2605}
2606
2607void StreamIndexedIO::Index::commitNodeToSubIndex( DirectoryNode *n )
2608{
2609 if (!n)
2610 {
2611 return;
2612 }
2613
2614 if ( n->subindex() == DirectoryNode::NoSubIndex )
2615 {
2616 MemoryStreamSink sink;
2617 io::filtering_ostream outIndexStream;
2618 outIndexStream.push( sink );
2619 assert( outIndexStream.is_complete() );
2620
2621 writeNodeChildren( n, outIndexStream );
2622
2623 outIndexStream.pop();
2624
2625 // compress the output stream using blosc before writing
2626 char* indexData = nullptr;
2627 std::streamsize indexDataSize;
2628
2629 sink.get(indexData, indexDataSize);
2630
2631 std::vector<char> compressedIndex;
2632 compress( indexData, indexDataSize, compressedIndex, indexCompressionLevel, indexCompressor, 1, BLOSC_MAX_BUFFERSIZE, 0);
2633
2634 uint32_t subindexSize = compressedIndex.size();
2635
2636 // tell the Directory node that it's contents have been written as a subindex
2637 uint64_t offset = writeUniqueData( &compressedIndex[0], subindexSize, true );
2638 n->setSubIndexOffset( offset );
2639 }
2640}
2641
2642void StreamIndexedIO::Index::readNodeFromSubIndex( DirectoryNode *n )
2643{

Callers 1

commitMethod · 0.80

Calls 7

compressFunction · 0.85
subindexMethod · 0.80
pushMethod · 0.80
setSubIndexOffsetMethod · 0.80
popMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected