account

package
v0.0.0-...-1e4ece9 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadChecksum = errors.New("unable to sha256sum the block")

Functions

This section is empty.

Types

type Account

type Account struct {
	Identifier ai.Identifier
	Username   string
	Email      email.Email
	Password   Keb
	GPG        gpg.GPG
	Version    ai.Version
	Reputation Reputation
}

func (*Account) Copy

func (a *Account) Copy() Account

Copy returns a struct Account with copied data from the *Account receiving the Copy()

func (*Account) VersionedIdentifier

func (a *Account) VersionedIdentifier() ai.Identifier

VersionedIdentifier returns a new copy of ai.Identifier and uses the ai.Version from the Account and applies it to the new ai.Identifier as its version

type Keb

type Keb []rune

type Reputation

type Reputation struct {
	Account                      *Account
	Blocks                       []wallet.Block
	BlockSize                    int64
	Pending                      []wallet.Reputation
	BlocksTotalPoints            int64
	BlocksTotalPointsVerifiedAt  time.Time
	PendingTotalPoints           int64
	PendingTotalPointsVerifiedAt time.Time
	PositiveActionCount          int64
	NegativeActionCount          int64
	LastBlockChecksum            [64]byte
	LastBlockTotalPoints         int64
	LastBlockTotalCount          int64
	LastBlockPositivePoints      int64
	LastBlockPositiveActionCount int64
	LastBlockNegativePoints      int64
	LastBlockNegativeActionCount int64
	Checksum                     [64]byte
	Version                      ai.Version
	// contains filtered or unexported fields
}

func (*Reputation) ActionCount

func (r *Reputation) ActionCount() int64

ActionCount combines Positive and Negative Action Counts

func (*Reputation) CheckPendingBlockSize

func (r *Reputation) CheckPendingBlockSize() *Reputation

CheckPendingBlockSize wraps up Pending in []wallet.Reputation into a new wallet.Block when at BlockSize in length

func (*Reputation) Copy

func (r *Reputation) Copy() Reputation

Copy function duplicates the data inside the Reputation struct into a new Reputation struct and logs the err

func (*Reputation) CountBlocks

func (r *Reputation) CountBlocks() int64

CountBlocks uses the BlocksTotalPoints and adds each Pending []wallet.Reputation to the result

func (*Reputation) Hash

func (r *Reputation) Hash() (ok bool)

Hash returns the sha256sum of the String() output of Reputation

func (*Reputation) Multiplier

func (r *Reputation) Multiplier() int64

Multiplier enforces no points for bad behavior

func (*Reputation) NegativeScaleWatchable

func (r *Reputation) NegativeScaleWatchable(scale int64) bool

NegativeScaleWatchable multiplies the NegativeActionCount by the scale and ensures its greater than PositiveActionCount

func (*Reputation) NegativeStreak

func (r *Reputation) NegativeStreak() bool

NegativeStreak returns true when the Pending []wallet.Reputation contains a sequence (newest first) of Action==ActionNegative & > 17 streaks hit

func (*Reputation) Points

func (r *Reputation) Points() int64

Points returns the BlockTotalPoints + Pending EarnedPoints() or initializes the BlocksTotalPoints if 0 with wallet.Block present in Blocks

func (*Reputation) PositiveScaleWatchable

func (r *Reputation) PositiveScaleWatchable(scale int64) bool

PositiveScaleWatchable multiplies the PositiveActionCount by the scale and ensure its greater than PositiveActionCount

func (*Reputation) PositiveStreak

func (r *Reputation) PositiveStreak() bool

PositiveStreak returns true when the Pending []wallet.Reputation contains a sequence (newest first) of Action==ActionPositive & > 17 streaks hit

func (*Reputation) String

func (r *Reputation) String() string

String cleanly prints the Reputation data that can be used for diagnostics and checksum hashing

func (*Reputation) Watchable

func (r *Reputation) Watchable() bool

Watchable returns if Positive < Negative in Action Counts

Jump to

Keyboard shortcuts

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