Interface for benchmarking

This commit is contained in:
Ashlie Martinez 2023-03-31 15:23:57 -07:00
parent fda1488ae2
commit 57454cb00b
2 changed files with 16 additions and 0 deletions

View File

@ -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

View File

@ -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)