bool DatabaseAdapter_DocMetaData::getBlock( const DatabaseCursorInterface::Slice& key, MetaDataBlock& blk) { if (!key.defined()) return false; char const* ki = key.ptr()+1; char const* ke = ki + key.size()-1; Index blockno = unpackIndex( ki, ke); DatabaseCursorInterface::Slice blkslice = m_cursor->value(); blk.init( m_descr, blockno, blkslice.ptr(), blkslice.size()); return true; }
bool DatabaseAdapter_StringIndex::Cursor::getData( const DatabaseCursorInterface::Slice& dbkey, std::string& key, Index& value) { if (!dbkey.defined()) return false; key = std::string( dbkey.ptr()+1, dbkey.size()-1); DatabaseCursorInterface::Slice blkslice = m_cursor->value(); char const* vi = blkslice.ptr(); char const* ve = vi + blkslice.size(); value = unpackIndex( vi, ve); return true; }
bool DatabaseAdapter_DataBlock::Cursor::getBlock( const DatabaseCursorInterface::Slice& key, DataBlock& blk) { if (!key.defined()) return false; char const* ki = key.ptr()+m_domainKeySize; char const* ke = ki + key.size()-m_domainKeySize; Index elemno = unpackIndex( ki, ke); DatabaseCursorInterface::Slice blkslice = m_cursor->value(); blk.init( elemno, blkslice.ptr(), blkslice.size()); return true; }
bool DatabaseAdapter_DocFrequency::Cursor::getData( const DatabaseCursorInterface::Slice& key, Index& typeno, Index& termno, Index& df) { if (!key.defined()) return false; char const* ki = key.ptr()+1; char const* ke = ki + key.size()-1; typeno = unpackIndex( ki, ke); termno = unpackIndex( ki, ke); DatabaseCursorInterface::Slice blkslice = m_cursor->value(); char const* vi = blkslice.ptr(); char const* ve = vi + blkslice.size(); df = unpackIndex( vi, ve); return true; }
static void dumpKeyValue( std::ostream& out, const DatabaseClientInterface* database, const DatabaseCursorInterface::Slice& key, const DatabaseCursorInterface::Slice& value) { try { switch (key.ptr()[0]) { case DatabaseKey::TermTypePrefix: { TermTypeData data( key, value); data.print( out); break; } case DatabaseKey::TermValuePrefix: { TermValueData data( key, value); data.print( out); break; } case DatabaseKey::DocIdPrefix: { DocIdData data( key, value); data.print( out); break; } case DatabaseKey::VariablePrefix: { VariableData data( key, value); data.print( out); break; } case DatabaseKey::DocAttributePrefix: { DocAttributeData data( key, value); data.print( out); break; } case DatabaseKey::TermTypeInvPrefix: { TermTypeInvData data( key, value); data.print( out); break; } case DatabaseKey::TermValueInvPrefix: { TermValueInvData data( key, value); data.print( out); break; } case DatabaseKey::ForwardIndexPrefix: { ForwardIndexData data( key, value); data.print( out); break; } case DatabaseKey::DocMetaDataPrefix: { MetaDataDescription metadescr( database); DocMetaDataData data( &metadescr, key, value); data.print( out); break; } case DatabaseKey::UserNamePrefix: { UserNameData data( key, value); data.print( out); break; } case DatabaseKey::DocFrequencyPrefix: { DocFrequencyData data( key, value); data.print( out); break; } case DatabaseKey::PosinfoBlockPrefix: { PosinfoBlockData data( key, value); data.print( out); break; } case DatabaseKey::UserAclBlockPrefix: { UserAclBlockData data( key, value); data.print( out); break; } case DatabaseKey::AclBlockPrefix: { AclBlockData data( key, value); data.print( out); break; } case DatabaseKey::DocListBlockPrefix: { DocListBlockData data( key, value); data.print( out); break; } case DatabaseKey::InverseTermPrefix: { InverseTermData data( key, value); data.print( out); break; } case DatabaseKey::MetaDataDescrPrefix: { MetaDataDescrData data( key, value); data.print( out); break; } case DatabaseKey::AttributeKeyPrefix: { AttributeKeyData data( key, value); data.print( out); break; } default: { throw strus::runtime_error( _TXT( "illegal data base key prefix for this storage")); } } } catch (const std::runtime_error& err) { std::string ks( extractKeyString( key)); throw strus::runtime_error( _TXT( "error in dumped dkey '%s': %s"), ks.c_str(), err.what()); } }