Documentation ¶
Overview ¶
Package info provides utilities for summarizing the contents of a kzip.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KzipInfo ¶
KzipInfo scans the kzip in f and counts contained files and units, giving a breakdown by corpus and language. It also records the size (in bytes) of the kzip specified by fileSize in the returned KzipInfo. This is a convenience method and thin wrapper over the Accumulator. If you need to do more than just calculate KzipInfo while doing a kzip.Scan(), you should use the Accumulator directly.
func KzipInfoTotalCount ¶ added in v0.0.32
func KzipInfoTotalCount(infos []*apb.KzipInfo) *apb.KzipInfo_CorpusInfo
KzipInfoTotalCount returns the total CompilationUnits counts for infos split apart by language.
Types ¶
type Accumulator ¶ added in v0.0.36
Accumulator is used to build a summary of a collection of compilation units. Usage:
a := NewAccumulator(fileSize) a.Accumulate(unit) // call for each compilation unit info := a.Get() // get the resulting KzipInfo
func NewAccumulator ¶ added in v0.0.36
func NewAccumulator(fileSize int64) *Accumulator
NewAccumulator creates a new Accumulator instance given the kzip fileSize (in bytes).
func (*Accumulator) Accumulate ¶ added in v0.0.36
func (a *Accumulator) Accumulate(u *kzip.Unit)
Accumulate should be called for each unit in the kzip so its counts can be recorded.
func (*Accumulator) Get ¶ added in v0.0.36
func (a *Accumulator) Get() *apb.KzipInfo
Get returns the final KzipInfo after info from each unit in the kzip has been accumulated.