data

package
v0.0.0-...-4a09e47 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

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

Data contains the server data

func NewData

func NewData() *Data

Create and initialize a Data structure

func (*Data) AddJob

func (d *Data) AddJob() int

Get a new jobId, add it to the hashMap, and increment inProgressCount

func (*Data) AddToHashTime

func (d *Data) AddToHashTime(t int64)

Add hash request time t to totalHashNanoseconds

func (*Data) ComputeHash

func (d *Data) ComputeHash(k int, s string)

Wait 5 seconds, compute the hash for s, store it in the hashMap, and decrement inProgressCount

func (*Data) Get

func (d *Data) Get(k int) (string, bool)

Return the computed hash value for jobId k, and its presence indicator

func (*Data) GetStats

func (d *Data) GetStats() (int, int64)

Return the total hash request count and the average time of a hash request in millisecs

func (*Data) IsBusy

func (d *Data) IsBusy() bool

Return busy if there are hash computations in progress

Jump to

Keyboard shortcuts

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