counting

package
v1.1.32 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: GPL-3.0 Imports: 5 Imported by: 1 module, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrentShardedCounts

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

ConcurrentShardedCounts keeps counts for a sharded data structure This implementation is concurrently safe

func NewConcurrentShardedCounts

func NewConcurrentShardedCounts() *ConcurrentShardedCounts

NewConcurrentShardedCounts creates a new ConcurrentShardedCounts

func (*ConcurrentShardedCounts) GetTotal

func (counts *ConcurrentShardedCounts) GetTotal() int64

GetTotal gets total count

func (*ConcurrentShardedCounts) IsInterfaceNil

func (counts *ConcurrentShardedCounts) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ConcurrentShardedCounts) PutCounts

func (counts *ConcurrentShardedCounts) PutCounts(shardName string, value int64)

PutCounts registers counts for a shard

func (*ConcurrentShardedCounts) String

func (counts *ConcurrentShardedCounts) String() string

type ConcurrentShardedCountsWithSize

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

ConcurrentShardedCountsWithSize keeps counts (with sizes) for a sharded data structure

func NewConcurrentShardedCountsWithSize

func NewConcurrentShardedCountsWithSize() *ConcurrentShardedCountsWithSize

NewConcurrentShardedCountsWithSize creates a new ShardedCountsWithSize

func (*ConcurrentShardedCountsWithSize) GetTotal

func (counts *ConcurrentShardedCountsWithSize) GetTotal() int64

GetTotal gets total count

func (*ConcurrentShardedCountsWithSize) GetTotalSize

func (counts *ConcurrentShardedCountsWithSize) GetTotalSize() int64

GetTotalSize gets total size

func (*ConcurrentShardedCountsWithSize) IsInterfaceNil

func (counts *ConcurrentShardedCountsWithSize) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ConcurrentShardedCountsWithSize) PutCounts

func (counts *ConcurrentShardedCountsWithSize) PutCounts(shardName string, counter int64, sizeInBytes int64)

PutCounts registers counts for a shard

func (*ConcurrentShardedCountsWithSize) String

func (counts *ConcurrentShardedCountsWithSize) String() string

type Counts

type Counts interface {
	GetTotal() int64
	String() string
	IsInterfaceNil() bool
}

Counts is an interface to interact with counts

type CountsWithSize

type CountsWithSize interface {
	Counts
	GetTotalSize() int64
}

CountsWithSize is an interface to interact with counts

type NullCounts

type NullCounts struct {
}

NullCounts implements null object pattern for counts

func (*NullCounts) GetTotal

func (counts *NullCounts) GetTotal() int64

GetTotal returns -1

func (*NullCounts) GetTotalSize

func (counts *NullCounts) GetTotalSize() int64

GetTotalSize returns -1

func (*NullCounts) IsInterfaceNil

func (counts *NullCounts) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*NullCounts) String

func (counts *NullCounts) String() string

String returns a placeholder

Jump to

Keyboard shortcuts

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