MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / BlockReader

Method BlockReader

tensorflow/core/lib/io/table.cc:94–122  ·  view source on GitHub ↗

Convert an index iterator value (i.e., an encoded BlockHandle) into an iterator over the contents of the corresponding block.

Source from the content-addressed store, hash-verified

92// Convert an index iterator value (i.e., an encoded BlockHandle)
93// into an iterator over the contents of the corresponding block.
94Iterator* Table::BlockReader(void* arg, const StringPiece& index_value) {
95 Table* table = reinterpret_cast<Table*>(arg);
96 // Cache* block_cache = table->rep_->options.block_cache;
97 Block* block = nullptr;
98 // Cache::Handle* cache_handle = NULL;
99
100 BlockHandle handle;
101 StringPiece input = index_value;
102 Status s = handle.DecodeFrom(&input);
103 // We intentionally allow extra stuff in index_value so that we
104 // can add more features in the future.
105
106 if (s.ok()) {
107 BlockContents contents;
108 s = ReadBlock(table->rep_->file, handle, &contents);
109 if (s.ok()) {
110 block = new Block(contents);
111 }
112 }
113
114 Iterator* iter;
115 if (block != nullptr) {
116 iter = block->NewIterator();
117 iter->RegisterCleanup(&DeleteBlock, block, nullptr);
118 } else {
119 iter = NewErrorIterator(s);
120 }
121 return iter;
122}
123
124Iterator* Table::NewIterator() const {
125 return NewTwoLevelIterator(rep_->index_block->NewIterator(),

Callers

nothing calls this directly

Calls 6

ReadBlockFunction · 0.85
NewErrorIteratorFunction · 0.85
DecodeFromMethod · 0.80
RegisterCleanupMethod · 0.80
okMethod · 0.45
NewIteratorMethod · 0.45

Tested by

no test coverage detected