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

Method Stat

memcache/raw_binary_client.go:721–757  ·  view source on GitHub ↗

See Client interface for documentation.

(statsKey string)

Source from the content-addressed store, hash-verified

719
720// See Client interface for documentation.
721func (c *RawBinaryClient) Stat(statsKey string) StatResponse {
722 shardEntries := make(map[int](map[string]string))
723 entries := make(map[string]string)
724 shardEntries[c.ShardId()] = entries
725
726 c.mutex.Lock()
727 defer c.mutex.Unlock()
728
729 if !isValidKeyString(statsKey) {
730 return NewStatErrorResponse(
731 errors.Newf("Invalid key: %s", statsKey),
732 shardEntries)
733 }
734
735 err := c.sendRequest(opStat, 0, []byte(statsKey), nil)
736 if err != nil {
737 return NewStatErrorResponse(err, shardEntries)
738 }
739
740 for true {
741 status, _, key, value, err := c.receiveResponse(opStat)
742 if err != nil {
743 return NewStatErrorResponse(err, shardEntries)
744 }
745 if status != StatusNoError {
746 // In theory, this is a valid state, but treating this as valid
747 // complicates the code even more.
748 c.validState = false
749 return NewStatResponse(status, shardEntries)
750 }
751 if key == nil && value == nil { // the last entry
752 break
753 }
754 entries[string(key)] = string(value)
755 }
756 return NewStatResponse(StatusNoError, shardEntries)
757}
758
759// See Client interface for documentation.
760func (c *RawBinaryClient) Version() VersionResponse {

Callers

nothing calls this directly

Calls 9

ShardIdMethod · 0.95
sendRequestMethod · 0.95
receiveResponseMethod · 0.95
NewfFunction · 0.92
isValidKeyStringFunction · 0.85
NewStatErrorResponseFunction · 0.85
NewStatResponseFunction · 0.85
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected