counting

package
v1.0.131 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Countable

type Countable interface {
	GetCounts() Counts
	IsInterfaceNil() bool
}

Countable is an interface to get counts

type Counts

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

Counts 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 gets total count

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 string representation of the counts

type ShardedCounts

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

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

func NewShardedCounts

func NewShardedCounts() *ShardedCounts

NewShardedCounts creates a new ShardedCounts

func (*ShardedCounts) GetTotal

func (counts *ShardedCounts) GetTotal() int64

GetTotal gets total count

func (*ShardedCounts) IsInterfaceNil

func (counts *ShardedCounts) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ShardedCounts) PutCounts

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

PutCounts registers counts for a shard

func (*ShardedCounts) String

func (counts *ShardedCounts) String() string

String returns a string representation of the counts

Jump to

Keyboard shortcuts

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