utils

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogDBStats

func LogDBStats(ctx context.Context, log logger.Logger, method string, reads uint32, writes uint32)

LogDBStats will call the logger to log the number of reads and writes for the feature

func NewDBCallCounter

func NewDBCallCounter() *dbCallCounter

NewDBCallCounter return new database calls counter

Types

type DBCallCounter

type DBCallCounter interface {
	// AddReadCall increments number of times database are read
	AddReadCall()
	// AddWriteCall increments number of times database are written
	AddWriteCall()
	// GetReadCalls returns the number of times database are read
	GetReadCalls() uint32
	// GetWriteCalls returns the number of times database are written
	GetWriteCalls() uint32
}

DBCallCounter allows counting the numbers of times database are read / write

type ResolutionMetadata

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

ResolutionMetadata stores the number of times database relationship are resolved. It also returns number of times the database is read from and written to.

func NewResolutionMetadata

func NewResolutionMetadata() *ResolutionMetadata

NewResolutionMetadata will return a new resolution metadata

func (*ResolutionMetadata) AddReadCall

func (r *ResolutionMetadata) AddReadCall()

AddReadCall increments number of times database are read

func (*ResolutionMetadata) AddResolve

func (r *ResolutionMetadata) AddResolve() uint32

AddResolve increments the number of times database are resolved for relationship

func (*ResolutionMetadata) AddWriteCall

func (r *ResolutionMetadata) AddWriteCall()

AddWriteCall increments number of times database are written

func (*ResolutionMetadata) Fork

Fork will create a new set of resolveCalls but share the same dbCall

func (*ResolutionMetadata) GetReadCalls

func (r *ResolutionMetadata) GetReadCalls() uint32

GetReadCalls returns the number of times database are read

func (*ResolutionMetadata) GetResolve

func (r *ResolutionMetadata) GetResolve() uint32

GetResolve returns the number of times database relationship are resolved

func (*ResolutionMetadata) GetWriteCalls

func (r *ResolutionMetadata) GetWriteCalls() uint32

GetWriteCalls returns the number of times database are written

Jump to

Keyboard shortcuts

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