See Client interface for documentation.
(statsKey string)
| 719 | |
| 720 | // See Client interface for documentation. |
| 721 | func (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. |
| 760 | func (c *RawBinaryClient) Version() VersionResponse { |
nothing calls this directly
no test coverage detected