MCPcopy Create free account
hub / github.com/Super-long/ChubbyGo / MarshalJSON

Method MarshalJSON

BaseServer/concurrentHashMap.go:320–329  ·  view source on GitHub ↗

Reviles ConcurrentMap "private" variables to json marshal. 可以用这个持久化

()

Source from the content-addressed store, hash-verified

318//Reviles ConcurrentMap "private" variables to json marshal.
319// 可以用这个持久化
320func (m ConcurrentHashMap) MarshalJSON() ([]byte, error) {
321 // Create a temporary map, which will hold all item spread across shards.
322 tmp := make(map[string]interface{})
323
324 // Insert items to temporary map.
325 for item := range m.IterBuffered() {
326 tmp[item.Key] = item.Val
327 }
328 return json.Marshal(tmp)
329}
330
331/*
332 * @param: 性能极其优异的哈希算法

Callers

nothing calls this directly

Calls 1

IterBufferedMethod · 0.95

Tested by

no test coverage detected