diff options
Diffstat (limited to 'adapter/vppapiclient')
-rw-r--r-- | adapter/vppapiclient/stat_client.go | 18 | ||||
-rw-r--r-- | adapter/vppapiclient/stat_client_stub.go | 6 |
2 files changed, 19 insertions, 5 deletions
diff --git a/adapter/vppapiclient/stat_client.go b/adapter/vppapiclient/stat_client.go index a124f59..734c158 100644 --- a/adapter/vppapiclient/stat_client.go +++ b/adapter/vppapiclient/stat_client.go @@ -83,7 +83,7 @@ func (c *statClient) Disconnect() error { return nil } -func (c *statClient) ListStats(patterns ...string) (stats []string, err error) { +func (c *statClient) ListStats(patterns ...string) (indexes []adapter.StatIdentifier, err error) { dir := C.govpp_stat_segment_ls(convertStringSlice(patterns)) if dir == nil { return nil, adapter.ErrStatsDataBusy @@ -93,11 +93,14 @@ func (c *statClient) ListStats(patterns ...string) (stats []string, err error) { l := C.govpp_stat_segment_vec_len(unsafe.Pointer(dir)) for i := 0; i < int(l); i++ { nameChar := C.govpp_stat_segment_dir_index_to_name(dir, C.uint32_t(i)) - stats = append(stats, C.GoString(nameChar)) + indexes = append(indexes, adapter.StatIdentifier{ + Name: []byte(C.GoString(nameChar)), + Index: uint32(i), + }) C.free(unsafe.Pointer(nameChar)) } - return stats, nil + return indexes, nil } func (c *statClient) DumpStats(patterns ...string) (stats []adapter.StatEntry, err error) { @@ -121,7 +124,10 @@ func (c *statClient) DumpStats(patterns ...string) (stats []adapter.StatEntry, e typ := adapter.StatType(C.govpp_stat_segment_data_type(&v)) stat := adapter.StatEntry{ - Name: []byte(name), + StatIdentifier: adapter.StatIdentifier{ + Name: []byte(name), + Index: uint32(i), + }, Type: typ, } @@ -184,6 +190,10 @@ func (c *statClient) PrepareDir(prefixes ...string) (*adapter.StatDir, error) { return nil, adapter.ErrNotImplemented } +func (c *statClient) PrepareDirOnIndex(indexes ...uint32) (*adapter.StatDir, error) { + return nil, adapter.ErrNotImplemented +} + func (c *statClient) UpdateDir(dir *adapter.StatDir) error { return adapter.ErrNotImplemented } diff --git a/adapter/vppapiclient/stat_client_stub.go b/adapter/vppapiclient/stat_client_stub.go index c764391..856a1e3 100644 --- a/adapter/vppapiclient/stat_client_stub.go +++ b/adapter/vppapiclient/stat_client_stub.go @@ -36,7 +36,7 @@ func (*stubStatClient) Disconnect() error { return nil } -func (*stubStatClient) ListStats(patterns ...string) (statNames []string, err error) { +func (*stubStatClient) ListStats(patterns ...string) (indexes []adapter.StatIdentifier, err error) { return nil, adapter.ErrNotImplemented } @@ -48,6 +48,10 @@ func (*stubStatClient) PrepareDir(prefixes ...string) (*adapter.StatDir, error) return nil, adapter.ErrNotImplemented } +func (*stubStatClient) PrepareDirOnIndex(indexes ...uint32) (*adapter.StatDir, error) { + return nil, adapter.ErrNotImplemented +} + func (*stubStatClient) UpdateDir(dir *adapter.StatDir) error { return adapter.ErrNotImplemented } |