C# 클래스 Kademlia.LocalStorage

Stores key/value pairs assigned to our node. Automatically handles persistence to disk.
파일 보기 프로젝트 열기: zencoders/sambatyon

공개 메소드들

메소드 설명
Contains ( ID key, ID hash ) : bool

Do we have the specified value for the given key?

ContainsKey ( ID key ) : bool

Do we have any data for the given key?

ContainsTag ( ID tag_id ) : bool
ContainsUrl ( ID tag_id, Uri uri ) : bool
Expire ( ) : void

Expire old entries

Get ( ID key ) : IList

Get all data values for the given key, or an empty list.

Get ( ID key, ID hash ) : string

Get a particular value by key and hash, or null.

GetAllElements ( ) : IList
GetHashes ( ID key ) : IList

Gets a list of all value hashes for the given key It's a copy, iterate all you want.

GetKeys ( ) : IList

Get all IDs, so we can go through and republish everything. It's a copy so you can iterate it all you want.

GetPublicationTime ( ID tag_id, Uri uri ) : DateTime
GetPublicationTime ( ID key, ID hash ) : DateTime?

Returns when the given value was last inserted by its original publisher, or null if the value isn't present.

LocalStorage ( ) : System

Make a new LocalStorage. Uses the executing assembly's name to determine the filename for on-disk storage. If another LocalStorage on the machine is already using that file, we use a temp directory.

Put ( ID key, ID hash, string val, DateTime timestamp, TimeSpan keepFor ) : void

Store a key/value pair published originally at the given UTC timestamp. Value is kept until keepTime past timestamp.

Put ( ID tag_id, Uri uri, DateTime publicationTime ) : void
RefreshResource ( ID tag_id, Uri uri, DateTime timestamp ) : void
Restamp ( ID key, ID hash, DateTime newStamp, TimeSpan newKeep ) : void

Change the timing information on an existing entry, if extant.

SearchFor ( string query ) : KademliaResource[]
StoreResource ( CompleteTag tag, Uri uri, DateTime publicationTime ) : void

비공개 메소드들

메소드 설명
BackgroundSave ( ) : void

Save the store in the background. PRECONSITION: We have the mutex and diskFilename is set.

CreatePath ( string path ) : void

Create all folders in a path, if missing.

PathFor ( ID key, ID hash ) : string

Where should we save a particular value?

SaveIndex ( ) : void

Save the index now.

메소드 상세

Contains() 공개 메소드

Do we have the specified value for the given key?
public Contains ( ID key, ID hash ) : bool
key ID
hash ID
리턴 bool

ContainsKey() 공개 메소드

Do we have any data for the given key?
public ContainsKey ( ID key ) : bool
key ID
리턴 bool

ContainsTag() 공개 메소드

public ContainsTag ( ID tag_id ) : bool
tag_id ID
리턴 bool

ContainsUrl() 공개 메소드

public ContainsUrl ( ID tag_id, Uri uri ) : bool
tag_id ID
uri Uri
리턴 bool

Expire() 공개 메소드

Expire old entries
public Expire ( ) : void
리턴 void

Get() 공개 메소드

Get all data values for the given key, or an empty list.
public Get ( ID key ) : IList
key ID
리턴 IList

Get() 공개 메소드

Get a particular value by key and hash, or null.
public Get ( ID key, ID hash ) : string
key ID
hash ID
리턴 string

GetAllElements() 공개 메소드

public GetAllElements ( ) : IList
리턴 IList

GetHashes() 공개 메소드

Gets a list of all value hashes for the given key It's a copy, iterate all you want.
public GetHashes ( ID key ) : IList
key ID
리턴 IList

GetKeys() 공개 메소드

Get all IDs, so we can go through and republish everything. It's a copy so you can iterate it all you want.
public GetKeys ( ) : IList
리턴 IList

GetPublicationTime() 공개 메소드

public GetPublicationTime ( ID tag_id, Uri uri ) : DateTime
tag_id ID
uri Uri
리턴 DateTime

GetPublicationTime() 공개 메소드

Returns when the given value was last inserted by its original publisher, or null if the value isn't present.
public GetPublicationTime ( ID key, ID hash ) : DateTime?
key ID
hash ID
리턴 DateTime?

LocalStorage() 공개 메소드

Make a new LocalStorage. Uses the executing assembly's name to determine the filename for on-disk storage. If another LocalStorage on the machine is already using that file, we use a temp directory.
public LocalStorage ( ) : System
리턴 System

Put() 공개 메소드

Store a key/value pair published originally at the given UTC timestamp. Value is kept until keepTime past timestamp.
public Put ( ID key, ID hash, string val, DateTime timestamp, TimeSpan keepFor ) : void
key ID
hash ID The hash of the value
val string
timestamp DateTime
keepFor TimeSpan
리턴 void

Put() 공개 메소드

public Put ( ID tag_id, Uri uri, DateTime publicationTime ) : void
tag_id ID
uri Uri
publicationTime DateTime
리턴 void

RefreshResource() 공개 메소드

public RefreshResource ( ID tag_id, Uri uri, DateTime timestamp ) : void
tag_id ID
uri Uri
timestamp DateTime
리턴 void

Restamp() 공개 메소드

Change the timing information on an existing entry, if extant.
public Restamp ( ID key, ID hash, DateTime newStamp, TimeSpan newKeep ) : void
key ID
hash ID
newStamp DateTime
newKeep TimeSpan
리턴 void

SearchFor() 공개 메소드

public SearchFor ( string query ) : KademliaResource[]
query string
리턴 KademliaResource[]

StoreResource() 공개 메소드

public StoreResource ( CompleteTag tag, Uri uri, DateTime publicationTime ) : void
tag CompleteTag
uri Uri
publicationTime DateTime
리턴 void