count

package
v0.0.0-...-d9d993d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BadCollPath                 = "bad_collection_path"
	BadPathPrefix               = "bad_path_prefix_creation"
	BadPrevPath                 = "unparsable_prev_path"
	CollectionTombstoneConflict = "collection_tombstone_conflicts_with_live_collection"
	ItemBeforeParent            = "item_before_parent"
	MissingParent               = "missing_parent"
	UnknownItemType             = "unknown_item_type"
)

Counted using clues error labels

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus struct {
	// contains filtered or unexported fields
}

Bus handles threadsafe counting of arbitrarily keyed metrics.

func New

func New() *Bus

func (*Bus) Add

func (b *Bus) Add(k Key, n int64) int64

Add increases the count by n.

func (*Bus) AdderFor

func (b *Bus) AdderFor(k Key) func(i int64)

AdderFor returns a func that adds any value of i to the bus using the given key.

func (*Bus) Get

func (b *Bus) Get(k Key) int64

Get returns the local count.

func (*Bus) Inc

func (b *Bus) Inc(k Key) int64

Inc increases the count by 1.

func (*Bus) Local

func (b *Bus) Local() *Bus

Local generates a bus with a parent link. Any value added to the local instance also updates the parent by the same increment. This allows you to maintain an isolated set of counts for a bounded context while automatically tallying the global total.

func (*Bus) PlainAdder

func (b *Bus) PlainAdder() *plainAdder

PlainAdder provides support to external packages that could take in a count.Bus but don't recognize the `Key` type, and would prefer a string type key.

func (*Bus) Total

func (b *Bus) Total(k Key) int64

Total returns the global count.

func (*Bus) TotalValues

func (b *Bus) TotalValues() map[string]int64

TotalValues returns a map of all global values. Not a snapshot, and therefore not threadsafe.

func (*Bus) Values

func (b *Bus) Values() map[string]int64

Values returns a map of all local values. Not a snapshot, and therefore not threadsafe.

type Key

type Key string
const (
	// count of bucket-tokens consumed by api calls.
	APICallTokensConsumed Key = "api-call-tokens-consumed"
	// count of api calls that resulted in failure due to throttling.
	ThrottledAPICalls Key = "throttled-api-calls"
)
const (
	PersistedCachedFiles          Key = "persisted-cached-files"
	PersistedDirectories          Key = "persisted-directories"
	PersistedFiles                Key = "persisted-files"
	PersistedHashedBytes          Key = "persisted-hashed-bytes"
	PersistedNonCachedFiles       Key = "persisted-non-cached-files"
	PersistedNonMetaFiles         Key = "persisted-non-meta-files"
	PersistedNonMetaUploadedBytes Key = "persisted-non-meta-uploaded-bytes"
	PersistedUploadedBytes        Key = "persisted-uploaded-bytes"
	PersistenceErrs               Key = "persistence-errs"
	PersistenceExpectedErrs       Key = "persistence-expected-errs"
	PersistenceIgnoredErrs        Key = "persistence-ignored-errs"
)

backup amounts reported by kopia

const (
	Channels                      Key = "channels"
	CollectionMoved               Key = "collection-moved"
	CollectionNew                 Key = "collection-state-new"
	CollectionNotMoved            Key = "collection-state-not-moved"
	CollectionTombstoned          Key = "collection-state-tombstoned"
	Collections                   Key = "collections"
	Containers                    Key = "containers"
	DeleteFolderMarker            Key = "delete-folder-marker"
	DeleteItemMarker              Key = "delete-item-marker"
	Drives                        Key = "drives"
	DriveTombstones               Key = "drive-tombstones"
	Files                         Key = "files"
	Folders                       Key = "folders"
	ItemsAdded                    Key = "items-added"
	ItemsRemoved                  Key = "items-removed"
	LazyDeletedInFlight           Key = "lazy-deleted-in-flight"
	Malware                       Key = "malware"
	MetadataItems                 Key = "metadata-items"
	MetadataBytes                 Key = "metadata-bytes"
	MissingDelta                  Key = "missing-delta-token"
	NewDeltas                     Key = "new-delta-tokens"
	NewPrevPaths                  Key = "new-previous-paths"
	NoDeltaQueries                Key = "cannot-make-delta-queries"
	Packages                      Key = "packages"
	PagerResets                   Key = "pager-resets"
	PrevDeltas                    Key = "previous-deltas"
	PrevPaths                     Key = "previous-paths"
	PreviousPathMetadataCollision Key = "previous-path-metadata-collision"
	Sites                         Key = "sites"
	Lists                         Key = "lists"
	SkippedContainers             Key = "skipped-containers"
	SkippedItems                  Key = "skipped-items"
	StreamBytesAdded              Key = "stream-bytes-added"
	StreamDirsAdded               Key = "stream-dirs-added"
	StreamDirsFound               Key = "stream-dirs-found"
	StreamItemsAdded              Key = "stream-items-added"
	StreamItemsDeletedInFlight    Key = "stream-items-deleted-in-flight"
	StreamItemsErred              Key = "stream-items-erred"
	StreamItemsFound              Key = "stream-items-found"
	StreamItemsRemoved            Key = "stream-items-removed"
	TotalContainersSkipped        Key = "total-containers-skipped"
	URLCacheMiss                  Key = "url-cache-miss"
	URLCacheRefresh               Key = "url-cache-refresh"
	URLCacheItemNotFound          Key = "url-cache-item-not-found"
)

backup amounts reported by data providers

const (
	TotalDeleteFilesProcessed   Key = "total-delete-files-processed"
	TotalDeleteFoldersProcessed Key = "total-delete-folders-processed"
	TotalDeltasProcessed        Key = "total-deltas-processed"
	TotalFilesProcessed         Key = "total-files-processed"
	TotalFoldersProcessed       Key = "total-folders-processed"
	TotalItemsProcessed         Key = "total-items-processed"
	TotalMalwareProcessed       Key = "total-malware-processed"
	TotalPackagesProcessed      Key = "total-packages-processed"
	TotalPagesEnumerated        Key = "total-pages-enumerated"
)

Total___Processed counts are used to track raw processing numbers for values that may have a similar, but different, end result count. For example: a delta query may add the same folder to many different pages. instead of adding logic to catch folder duplications and only count new entries, we can increment TotalFoldersProcessed for every duplication, and use a separate Key (Folders) for the end count of folders produced at the end of the delta enumeration.

const (
	// count of times that items had collisions during restore,
	// and that collision was solved by replacing the item.
	CollisionReplace Key = "collision-replace"
	// count of times that items had collisions during restore,
	// and that collision was solved by skipping the item.
	CollisionSkip Key = "collision-skip"
	// NewItemCreated should be used for non-skip, non-replace,
	// non-meta item creation counting.  IE: use it specifically
	// for counting new items (no collision) or copied items.
	NewItemCreated Key = "new-item-created"
)

Tracked during restore

const (
	RequiresUserPnToIDMigration Key = "requires-user-pn-to-id-migration"
)

miscellaneous

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL