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

Method EncodeKey

driver/crdt/db.go:205–220  ·  view source on GitHub ↗
(key []byte)

Source from the content-addressed store, hash-verified

203}
204
205func (dn *DB) EncodeKey(key []byte) []byte {
206 if len(key) > 0 && !utf8.Valid(key) {
207 buf := bytes.NewBuffer(nil)
208 tem := make([]byte, 2)
209 for k, b := range key {
210 if b > 127 {
211 hex.Encode(tem, key[k:k+1])
212 buf.Write(tem)
213 } else {
214 buf.WriteByte(b)
215 }
216 }
217 key = buf.Bytes()
218 }
219 return key
220}

Callers 4

PutMethod · 0.95
GetMethod · 0.95
DeleteMethod · 0.95
SeekMethod · 0.80

Calls 3

EncodeMethod · 0.65
ValidMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected