Метод | Описание | |
---|---|---|
ContainsTag ( string tagid ) : bool |
Checks if the repository contains a given tag
|
|
ContainsUrl ( string tagid, |
Checks if the given resource contains the Url in its supplier list
|
|
DeleteTag ( string tid ) : bool |
Deletes a tag with a given identifier. This method finds all keywords containing a reference to the tag to be deleted and removes the tag identifier from the keyword's list; then it search for keywords that has an empty list and deletes them. At the end the method removes the resource from the repository
|
|
DiscardSemanticlessWords ( string str ) : string |
This methods removes all duplicated white space and then removes all semanticless words.
|
|
Dispose ( ) : void |
Method used to dispose the repository
|
|
Expire ( ) : void |
Method that removes the expired elements from the DHT. This method search for expired element and add it to a structure, then delete all the expired elements and if a resource remanins without any supplier will be deleted too.
|
|
Get ( string tagid ) : |
Returns the Resource identified by the given taghash.
|
|
GetAllElements ( ) : LinkedList |
Returns a list of all resources of the repository.
|
|
GetPublicationTime ( string tagid, |
Returns the publication time of a Dht Element related to a Resource.
|
|
KademliaRepository ( string repType = "Raven", RepositoryConfiguration conf = null, string elementValidity = "1", string semanticFilter = KademliaRepository.DefaultSemanticFilterRegexString ) : System |
Constructor for the Kademlia Repository. This begins with compiling regular expressions for whitespace and semanticless words and setting timespan sing the given values (if they are not passed, it uses the default). Then instantiates the repository of the fiven type and creates two indexes over the instantiatied repository. The first index is used to find keywords with an empty tag list; the second one is used to query keyword using tag identifier. Both indexes are necessary in order to cleanly delete resources and keywords from the repository
|
|
Put ( string tagid, |
Method that implements the registration of a peer as supplier for a given resource. This method just load the resource and adds the Dht Element if it's not already in the suppliers list.
|
|
RefreshResource ( string tagid, |
Sets the publication time of a Dht Element in order to avoid expiration
|
|
SearchFor ( string query ) : Persistence.KademliaResource[] |
Performs search query over the repository. This split query in pieces and search for keywords that contains those pieces. Then for each keyword the method loads all the related resource.
|
|
StoreResource ( CompleteTag tag, |
Stores a tag as resource into the kademlia repository. If the resource already exists the method tries to add the given Url (with the desired publication time) to the list of suppliers for that resource; if the url is already known the method does nothing. If the resource is new first the method adds it to the repository and then generates a set of keywords related to the new resource. For each generated keyword, if this is already in the repository the tag identifier (that is the resource identifier too) will be added to the related tags list, if the keyword doesn't exist it will be created and its related tags list will contains only the new resource.
|
Метод | Описание | |
---|---|---|
generatePrimaryKey ( CompleteTag tag ) : string[] |
Generates a clean list (without semanticless words) of keyword related to the given tag
|
public ContainsTag ( string tagid ) : bool | ||
tagid | string | Resource Identifier to search |
Результат | bool |
public ContainsUrl ( string tagid, |
||
tagid | string | Resource identifier |
url | Url of the supplier | |
Результат | bool |
public DeleteTag ( string tid ) : bool | ||
tid | string | Identifier of the tag to be deleted |
Результат | bool |
public DiscardSemanticlessWords ( string str ) : string | ||
str | string | String to be cleaned |
Результат | string |
public Get ( string tagid ) : |
||
tagid | string | Identifier of the resource to get |
Результат |
public GetPublicationTime ( string tagid, |
||
tagid | string | Resource Identifier |
url | Url of the Dht Element | |
Результат | System.DateTime |
public KademliaRepository ( string repType = "Raven", RepositoryConfiguration conf = null, string elementValidity = "1", string semanticFilter = KademliaRepository.DefaultSemanticFilterRegexString ) : System | ||
repType | string | Name of the repository type. The default repository type is RavenDB ("Raven") |
conf | RepositoryConfiguration | Repository Configureation |
elementValidity | string | Validity period of a Dht Element. Default value is 24 hours (1 day). The validity must /// be expressed in timespan format as described in MSDN reference for this type. |
semanticFilter | string | Regular expression that will be used to remove semanticless word. |
Результат | System |
public Put ( string tagid, |
||
tagid | string | Resource Identifier |
url | Url of the supplier | |
pubtime | System.DateTime | Publication Time for the supplier |
Результат | bool |
public RefreshResource ( string tagid, |
||
tagid | string | Resource Identifier |
url | URL of the Dht Element to refresh | |
pubtime | System.DateTime | Publication time to set |
Результат | bool |
public SearchFor ( string query ) : Persistence.KademliaResource[] | ||
query | string | Query string |
Результат | Persistence.KademliaResource[] |
public StoreResource ( CompleteTag tag, |
||
tag | CompleteTag | Tag to store in the kademlia resource |
peer | Url of the supplier | |
pubtime | System.DateTime | Publication TIme |
Результат | bool |