mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-17 02:47:51 +01:00
Simplify Store interface. Remove unused replication placeholder and untangle expiration option.
MemoryStore is refactored into separate file.
This commit is contained in:
@@ -153,14 +153,14 @@ func GetDataDHT(hash []byte) (data []byte, senderNodeID []byte, found bool) {
|
||||
// StoreDataLocal stores data into the local warehouse.
|
||||
func StoreDataLocal(data []byte) error {
|
||||
key := hashData(data)
|
||||
return Warehouse.Store(key, data, time.Time{}, time.Time{})
|
||||
return Warehouse.Store(key, data)
|
||||
}
|
||||
|
||||
// StoreDataDHT stores data locally and informs closestCount peers in the DHT about it.
|
||||
// Remote peers may choose to keep a record (in case another peers asks) or mirror the full data.
|
||||
func StoreDataDHT(data []byte, closestCount int) error {
|
||||
key := hashData(data)
|
||||
if err := Warehouse.Store(key, data, time.Time{}, time.Time{}); err != nil {
|
||||
if err := Warehouse.Store(key, data); err != nil {
|
||||
return err
|
||||
}
|
||||
return nodesDHT.Store(key, uint64(len(data)), closestCount)
|
||||
|
||||
Reference in New Issue
Block a user