MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / Value

Method Value

driver/ipfs-synckv/iterator.go:21–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19 return it.it.Key()
20}
21
22func (it *Iterator) Value() []byte {
23 key := it.it.Key()
24 // Try to get the value from IPFS first for consistency
25 if it.ipfsDB != nil {
26 value, err := it.ipfsDB.Get(key)
27 if err == nil && value != nil {
28 if it.db.encryptionKey != nil {
29 if pt, derr := decrypt(value, it.db.encryptionKey); derr == nil {
30 return pt
31 } else {
32 log.Printf("ipfs-synckv: iterator decrypt failed for key %q, falling back to local value: %v", key, derr)
33 }
34 // Decrypt failed (corrupt/foreign data): fall through to the local value.
35 } else {
36 return value
37 }
38 }

Callers 2

TestIteratorFunction · 0.95
TestIteratorPrefixFunction · 0.95

Calls 3

decryptFunction · 0.70
KeyMethod · 0.45
GetMethod · 0.45

Tested by 2

TestIteratorFunction · 0.76
TestIteratorPrefixFunction · 0.76