strus  0.17
Public Types | Public Member Functions | List of all members
strus::StorageClientInterface Class Referenceabstract

Interface of a strus IR storage. More...

#include <storageClientInterface.hpp>

Public Types

enum  DocumentStatisticsType { StatNofTerms = 1, StatNofTermOccurrencies = 2 }
 Enumeration of document statistics. More...
 

Public Member Functions

virtual ~StorageClientInterface ()
 Destructor. More...
 
virtual std::string config () const =0
 Get the interpreted configuration this storage client was created with. More...
 
virtual PostingIteratorInterfacecreateTermPostingIterator (const std::string &type, const std::string &value, const Index &length) const =0
 Create an iterator on the occurrencies of a term in the storage. More...
 
virtual StructIteratorInterfacecreateStructIterator (const std::string &structstr) const =0
 Create an iterator on the structures (relations of ordinal position ranges) of a defined type. More...
 
virtual PostingIteratorInterfacecreateBrowsePostingIterator (const MetaDataRestrictionInterface *restriction, const Index &maxpos) const =0
 Create an iterator on all enumerable postings of document selected by a metadata restriction. More...
 
virtual PostingIteratorInterfacecreateFieldPostingIterator (const std::string &meta_fieldStart, const std::string &meta_fieldEnd) const =0
 Create an iterator postings specified as field in the meta data (by start and end position) More...
 
virtual ForwardIteratorInterfacecreateForwardIterator (const std::string &type) const =0
 Create a viewer to inspect the term stored values with the forward index of the storage. More...
 
virtual
DocumentTermIteratorInterface
createDocumentTermIterator (const std::string &type) const =0
 Create an iterator on term occurrencies in documents (support for feature selection) More...
 
virtual InvAclIteratorInterfacecreateInvAclIterator (const std::string &username) const =0
 Create a an iterator on the numbers of documents a specified user is allowed to see. More...
 
virtual AclReaderInterfacecreateAclReader () const =0
 Create a an iterator on the access control lists of documents. More...
 
virtual Index nofDocumentsInserted () const =0
 Get the number of documents inserted in this storage instance. More...
 
virtual Index documentFrequency (const std::string &type, const std::string &term) const =0
 Get the local document frequency of a feature in this storage instance. More...
 
virtual Index maxDocumentNumber () const =0
 Get the highest document number used in this stogage. More...
 
virtual Index documentNumber (const std::string &docid) const =0
 Get the local internal document number. More...
 
virtual Index termTypeNumber (const std::string &type) const =0
 Get the local internal term type number. More...
 
virtual bool isForwardIndexTerm (const std::string &type) const =0
 Evaluate if there exists forward index blocks for this type. More...
 
virtual ValueIteratorInterfacecreateTermTypeIterator () const =0
 Create an iterator on the term types inserted. More...
 
virtual ValueIteratorInterfacecreateStructTypeIterator () const =0
 Create an iterator on the structure types inserted. More...
 
virtual ValueIteratorInterfacecreateTermValueIterator () const =0
 Create an iterator on the term value inserted. More...
 
virtual ValueIteratorInterfacecreateDocIdIterator () const =0
 Create an iterator on the document identifiers inserted. More...
 
virtual ValueIteratorInterfacecreateUserNameIterator () const =0
 Create an iterator on the user names used in document access restrictions. More...
 
virtual Index documentStatistics (const Index &docno, const DocumentStatisticsType &stat, const std::string &type) const =0
 Get one specified element of the documents statistics for a term type on the local server node. More...
 
virtual MetaDataReaderInterfacecreateMetaDataReader () const =0
 Create an interface to access items of document metadata. More...
 
virtual
MetaDataRestrictionInterface
createMetaDataRestriction () const =0
 Create an object for restrictions on metadata. More...
 
virtual AttributeReaderInterfacecreateAttributeReader () const =0
 Create an interface to access attributes attached to documents for representation. More...
 
virtual
StorageTransactionInterface
createTransaction ()=0
 Create an insert/update transaction object. More...
 
virtual
StatisticsIteratorInterface
createAllStatisticsIterator (bool sign=true)=0
 Creates an iterator on storage statistics messages for initialization/deregistration. More...
 
virtual
StatisticsIteratorInterface
createChangeStatisticsIterator ()=0
 Creates an iterator on the storage statistics messages created by updates of this storage. More...
 
virtual const
StatisticsProcessorInterface
getStatisticsProcessor () const =0
 Get the processing message interface for introspecting and packing messages outside the queue context. More...
 
virtual StorageDocumentInterfacecreateDocumentChecker (const std::string &docid, const std::string &logfilename) const =0
 Create an interface to verify, if the contents of a document are inserted correctly into the storage. The checking is invoked by calling the StorageDocumentInterface::done() method after the definition of all elements. More...
 
virtual bool checkStorage (std::ostream &errorlog) const =0
 Iterate through all key/value pairs and check their data for validity. More...
 
virtual void close ()=0
 Close client connection and eventually do some cleanup. More...
 

Detailed Description

Interface of a strus IR storage.

Member Enumeration Documentation

Enumeration of document statistics.

Enumerator
StatNofTerms 

number of distinct terms

StatNofTermOccurrencies 

number of accumulated dfs (number of terms)

Constructor & Destructor Documentation

virtual strus::StorageClientInterface::~StorageClientInterface ( )
inlinevirtual

Destructor.

Remarks
Should call call 'close()' but ignore errors there silently

Member Function Documentation

virtual bool strus::StorageClientInterface::checkStorage ( std::ostream &  errorlog) const
pure virtual

Iterate through all key/value pairs and check their data for validity.

Parameters
[out]errorlogstream for reporting errors
Returns
true, if the check succeeds, false if it fails
virtual void strus::StorageClientInterface::close ( )
pure virtual

Close client connection and eventually do some cleanup.

Remarks
This method is not implicitely called with the destructor because it might be a complicated operation that cannot be afforded in panic shutdown.
Note
the method does not have to be called necessarily
it calls compactDatabase of the underlying database and can therefore last some time (some minutes in case of leveldb after large inserts).
virtual std::string strus::StorageClientInterface::config ( ) const
pure virtual

Get the interpreted configuration this storage client was created with.

Returns
the configuration as string
virtual AclReaderInterface* strus::StorageClientInterface::createAclReader ( ) const
pure virtual

Create a an iterator on the access control lists of documents.

Returns
the iterator on the ACLs
Note
The storage has to be created with access control enabled
virtual StatisticsIteratorInterface* strus::StorageClientInterface::createAllStatisticsIterator ( bool  sign = true)
pure virtual

Creates an iterator on storage statistics messages for initialization/deregistration.

Parameters
[in]signtrue = positive, false = negative, means all offsets are inverted and isnew is false too (used for deregistration)
Returns
the iterator on the statistics message blobs
virtual AttributeReaderInterface* strus::StorageClientInterface::createAttributeReader ( ) const
pure virtual

Create an interface to access attributes attached to documents for representation.

Returns
the interface to access document attributes (with ownership)
virtual PostingIteratorInterface* strus::StorageClientInterface::createBrowsePostingIterator ( const MetaDataRestrictionInterface restriction,
const Index maxpos 
) const
pure virtual

Create an iterator on all enumerable postings of document selected by a metadata restriction.

Parameters
[in]restrictionrestriction on metadata that have to be fulfilled by the documents referenced in the result posting sets.
[in]maxposmaximum position visited.
Returns
the created iterator reference (with ownership)
Note
This iterator use is mainly for browsing occurrencies fulfilling a condition without query involved
Remarks
The iterator does not take the alive status of the documents into account. You have to formulate a restriction expression that does not match deleted documents if you do not want deleted documents in your iterated set of postings.
The iterator does not take the document length into account. It returns the set of postings with positions in the range [1..maxpos]. Read postings you get only when joining this set with another.
virtual StatisticsIteratorInterface* strus::StorageClientInterface::createChangeStatisticsIterator ( )
pure virtual

Creates an iterator on the storage statistics messages created by updates of this storage.

Returns
the iterator on the statistics message blobs
virtual ValueIteratorInterface* strus::StorageClientInterface::createDocIdIterator ( ) const
pure virtual

Create an iterator on the document identifiers inserted.

Returns
the iterator
virtual StorageDocumentInterface* strus::StorageClientInterface::createDocumentChecker ( const std::string &  docid,
const std::string &  logfilename 
) const
pure virtual

Create an interface to verify, if the contents of a document are inserted correctly into the storage. The checking is invoked by calling the StorageDocumentInterface::done() method after the definition of all elements.

Parameters
[in]docididentifier (URI) of the document to check
[in]logfilenameWhere to log checking failures ("-" for stdout)
Returns
the created document interface (with ownership)
virtual DocumentTermIteratorInterface* strus::StorageClientInterface::createDocumentTermIterator ( const std::string &  type) const
pure virtual

Create an iterator on term occurrencies in documents (support for feature selection)

Parameters
[in]typetype name of the term
Returns
the created iterator reference (with ownership)
virtual PostingIteratorInterface* strus::StorageClientInterface::createFieldPostingIterator ( const std::string &  meta_fieldStart,
const std::string &  meta_fieldEnd 
) const
pure virtual

Create an iterator postings specified as field in the meta data (by start and end position)

Parameters
[in]meta_fieldStartmeta data element that specifies the start of the field
[in]meta_fieldEndmeta data element that specifies the end of the field (first position not belonging to the field anymore)
Returns
the created iterator reference (with ownership)
Note
Fields can avoid superfluos access on posting blocks
Fields give you the possibility to treat elements in the document differently while using the same statistics that are defined by feature type
virtual ForwardIteratorInterface* strus::StorageClientInterface::createForwardIterator ( const std::string &  type) const
pure virtual

Create a viewer to inspect the term stored values with the forward index of the storage.

Parameters
[in]typetype name of the term to be inspected
Returns
the created viewer reference to be disposed with delete
virtual InvAclIteratorInterface* strus::StorageClientInterface::createInvAclIterator ( const std::string &  username) const
pure virtual

Create a an iterator on the numbers of documents a specified user is allowed to see.

Parameters
[in]usernamename of the user
Returns
the iterator on the documents (with ownership) or NULL, if there is no access control enabled
Note
The storage has to be created with access control enabled
virtual MetaDataReaderInterface* strus::StorageClientInterface::createMetaDataReader ( ) const
pure virtual

Create an interface to access items of document metadata.

Returns
the interface to access document metadata (with ownership)
virtual MetaDataRestrictionInterface* strus::StorageClientInterface::createMetaDataRestriction ( ) const
pure virtual

Create an object for restrictions on metadata.

Returns
the created, uninitialized restriction object
virtual StructIteratorInterface* strus::StorageClientInterface::createStructIterator ( const std::string &  structstr) const
pure virtual

Create an iterator on the structures (relations of ordinal position ranges) of a defined type.

Parameters
[in]structstrname of the structure to get the iterator on
Returns
the created iterator reference (with ownership)
virtual ValueIteratorInterface* strus::StorageClientInterface::createStructTypeIterator ( ) const
pure virtual

Create an iterator on the structure types inserted.

Returns
the iterator
virtual PostingIteratorInterface* strus::StorageClientInterface::createTermPostingIterator ( const std::string &  type,
const std::string &  value,
const Index length 
) const
pure virtual

Create an iterator on the occurrencies of a term in the storage.

Parameters
[in]typetype name of the term
[in]valuevalue string of the term
[in]lengthordinal position length assigned to the term (may differ from 1 for terms representing multipart patterns)
Remarks
the length is considered as an attribute and not used in set operations for joining posting sets. It is used as hint only in some summarization and weighting functions for handling multi-word phrases correctly.
Returns
the created iterator reference (with ownership)
virtual ValueIteratorInterface* strus::StorageClientInterface::createTermTypeIterator ( ) const
pure virtual

Create an iterator on the term types inserted.

Returns
the iterator
virtual ValueIteratorInterface* strus::StorageClientInterface::createTermValueIterator ( ) const
pure virtual

Create an iterator on the term value inserted.

Returns
the iterator
virtual StorageTransactionInterface* strus::StorageClientInterface::createTransaction ( )
pure virtual

Create an insert/update transaction object.

Returns
the created transaction interface (with ownership)
Note
this function is thread safe, multiple concurrent transactions are allowed
virtual ValueIteratorInterface* strus::StorageClientInterface::createUserNameIterator ( ) const
pure virtual

Create an iterator on the user names used in document access restrictions.

Returns
the iterator
virtual Index strus::StorageClientInterface::documentFrequency ( const std::string &  type,
const std::string &  term 
) const
pure virtual

Get the local document frequency of a feature in this storage instance.

Parameters
[in]typethe term type addressed
[in]termthe term value addressed
Returns
the local document frequency
virtual Index strus::StorageClientInterface::documentNumber ( const std::string &  docid) const
pure virtual

Get the local internal document number.

Parameters
[in]dociddocument id of the document inserted
Returns
the document number or 0, if it does not exist
virtual Index strus::StorageClientInterface::documentStatistics ( const Index docno,
const DocumentStatisticsType stat,
const std::string &  type 
) const
pure virtual

Get one specified element of the documents statistics for a term type on the local server node.

Parameters
[in]docnothe local internal document number addressed (return value of documentNumber( const std::string&) const)
[in]statthe enumeration value of the statistics to get
[in]typethe term type addressed
virtual const StatisticsProcessorInterface* strus::StorageClientInterface::getStatisticsProcessor ( ) const
pure virtual

Get the processing message interface for introspecting and packing messages outside the queue context.

Returns
the message processor interface
virtual bool strus::StorageClientInterface::isForwardIndexTerm ( const std::string &  type) const
pure virtual

Evaluate if there exists forward index blocks for this type.

Parameters
[in]typeterm type name
Returns
true, if yes, false if no or if an error occurred (check error)
virtual Index strus::StorageClientInterface::maxDocumentNumber ( ) const
pure virtual

Get the highest document number used in this stogage.

Returns
the document number, or 0, if no documents are inserted
virtual Index strus::StorageClientInterface::nofDocumentsInserted ( ) const
pure virtual

Get the number of documents inserted in this storage instance.

Returns
the number of documents
virtual Index strus::StorageClientInterface::termTypeNumber ( const std::string &  type) const
pure virtual

Get the local internal term type number.

Parameters
[in]typeterm type name
Returns
the term type number or 0, if it is not known yet

The documentation for this class was generated from the following file: