MCPcopy
hub / github.com/dropbox/godropbox / getMultiHelper

Method getMultiHelper

memcache/sharded_client.go:82–120  ·  view source on GitHub ↗
(
	shard int,
	conn net2.ManagedConn,
	connErr error,
	keys []string,
	resultsChannel chan map[string]GetResponse)

Source from the content-addressed store, hash-verified

80}
81
82func (c *ShardedClient) getMultiHelper(
83 shard int,
84 conn net2.ManagedConn,
85 connErr error,
86 keys []string,
87 resultsChannel chan map[string]GetResponse) {
88
89 var results map[string]GetResponse
90 if shard == -1 {
91 results = make(map[string]GetResponse)
92 for _, key := range keys {
93 results[key] = NewGetErrorResponse(key, c.unmappedError(key))
94 }
95 } else if connErr != nil {
96 results = make(map[string]GetResponse)
97 for _, key := range keys {
98 results[key] = NewGetErrorResponse(
99 key,
100 c.connectionError(shard, connErr))
101 }
102 } else if conn == nil {
103 results = make(map[string]GetResponse)
104 for _, key := range keys {
105 // NOTE: zero is an invalid version id.
106 results[key] = NewGetResponse(key, StatusKeyNotFound, 0, nil, 0)
107 }
108 } else {
109 client := c.builder(shard, conn)
110 defer c.release(client, conn)
111
112 results = client.GetMulti(keys)
113 if client.IsValidState() {
114 getOkByAddr.Add(conn.Key().Address, 1)
115 } else {
116 getErrByAddr.Add(conn.Key().Address, 1)
117 }
118 }
119 resultsChannel <- results
120}
121
122// See Client interface for documentation.
123func (c *ShardedClient) GetMulti(keys []string) map[string]GetResponse {

Callers 1

getMultiMethod · 0.95

Calls 9

unmappedErrorMethod · 0.95
connectionErrorMethod · 0.95
releaseMethod · 0.95
NewGetErrorResponseFunction · 0.85
NewGetResponseFunction · 0.85
GetMultiMethod · 0.65
IsValidStateMethod · 0.65
AddMethod · 0.65
KeyMethod · 0.65

Tested by

no test coverage detected