|
|
|
@ -258,12 +258,32 @@ func (c *cmd) enhance(file io.Reader) (SnapshotInfo, error) {
|
|
|
|
|
info.TotalSize = cr.read |
|
|
|
|
info.Stats[msg] = s |
|
|
|
|
|
|
|
|
|
c.kvEnhance(s.Name, val, size, &info) |
|
|
|
|
|
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
if err := fsm.ReadSnapshot(cr, handler); err != nil { |
|
|
|
|
return info, err |
|
|
|
|
} |
|
|
|
|
return info, nil |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c *cmd) kvEnhance(keyType string, val interface{}, size int, info *SnapshotInfo) { |
|
|
|
|
if c.detailed { |
|
|
|
|
if s.Name == "KVS" { |
|
|
|
|
switch val := val.(type) { |
|
|
|
|
case map[string]interface{}: |
|
|
|
|
for k, v := range val { |
|
|
|
|
if k == "Key" { |
|
|
|
|
if keyType != "KVS" { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// have to coerce this into a usable type here or this won't work
|
|
|
|
|
keyVal := val.(map[string]interface{}) |
|
|
|
|
for k, v := range keyVal { |
|
|
|
|
// we only care about the entry on the key specifically
|
|
|
|
|
// related to the key name, so skip all others
|
|
|
|
|
if k != "Key" { |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// check for whether a filter is specified. if it is, skip
|
|
|
|
|
// any keys that don't match.
|
|
|
|
|
if len(c.filter) > 0 && !strings.HasPrefix(v.(string), c.filter) { |
|
|
|
@ -291,17 +311,6 @@ func (c *cmd) enhance(file io.Reader) (SnapshotInfo, error) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
if err := fsm.ReadSnapshot(cr, handler); err != nil { |
|
|
|
|
return info, err |
|
|
|
|
} |
|
|
|
|
return info, nil |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c *cmd) Synopsis() string { |
|
|
|
|
return synopsis |
|
|
|
|