From 57454cb00b172cdea7418803d914059b1e21e08c Mon Sep 17 00:00:00 2001 From: Ashlie Martinez Date: Fri, 31 Mar 2023 15:23:57 -0700 Subject: [PATCH] Interface for benchmarking --- src/cmd/jsondebug/common/helpers.go | 5 +++++ src/cmd/jsondebug/decoder/manifst_decoder.go | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/cmd/jsondebug/common/helpers.go b/src/cmd/jsondebug/common/helpers.go index 937010d7d..f780540e0 100644 --- a/src/cmd/jsondebug/common/helpers.go +++ b/src/cmd/jsondebug/common/helpers.go @@ -3,6 +3,7 @@ package common import ( "encoding/json" "fmt" + "io" "runtime" "time" ) @@ -99,6 +100,10 @@ type DirectorySummary struct { IgnoredErrorCount int `json:"numIgnoredErrors,omitempty"` } +type ManifestDecoder interface { + Decode(r io.Reader, gcStats bool) error +} + func PrintMemUsage() { var m runtime.MemStats diff --git a/src/cmd/jsondebug/decoder/manifst_decoder.go b/src/cmd/jsondebug/decoder/manifst_decoder.go index 5dc7232da..5c2c5c832 100644 --- a/src/cmd/jsondebug/decoder/manifst_decoder.go +++ b/src/cmd/jsondebug/decoder/manifst_decoder.go @@ -9,6 +9,17 @@ import ( "github.com/alcionai/corso/src/cmd/jsondebug/common" ) +var ( + _ common.ManifestDecoder = Array{} +) + +type Array struct{} + +func (d Array) Decode(r io.Reader, gcStats bool) error { + _, err := DecodeManifestArray(r) + return err +} + func DecodeManifestArray(r io.Reader) (common.Manifest, error) { var ( dec = json.NewDecoder(r)