MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / Insert

Method Insert

merkle/patriciatrie.go:40–45  ·  view source on GitHub ↗

Insert serializes key into binary and computes its hash, then stores the (hash(key), value) into the trie.

(key []byte, value []byte)

Source from the content-addressed store, hash-verified

38// Insert serializes key into binary and computes its hash,
39// then stores the (hash(key), value) into the trie.
40func (trie *Trie) Insert(key []byte, value []byte) (inserted bool) {
41 hashedKey := hash.HashB(key)
42
43 inserted = trie.trie.Insert(hashedKey, value)
44 return
45}
46
47// Get returns the value according to the key.
48func (trie *Trie) Get(key []byte) ([]byte, error) {

Callers 15

TestTrie_InsertFunction · 0.80
TestTrie_GetFunction · 0.80
AddProjectConfigFunction · 0.80
AddRawProjectConfigFunction · 0.80
AddProjectFunction · 0.80
EnsureDeveloperFunction · 0.80
NewSessionFunction · 0.80
NewTaskFunction · 0.80
AddNewPrivateKeyFunction · 0.80
SavePrivateKeyFunction · 0.80
AddTokenApplyRecordFunction · 0.80
PreRegisterUserFunction · 0.80

Calls 1

HashBFunction · 0.92

Tested by 2

TestTrie_InsertFunction · 0.64
TestTrie_GetFunction · 0.64