spamalot

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2018 License: MIT Imports: 11 Imported by: 0

README

spamalot (wip) Build Status

Core spammer executable used by coordinator and slaves.

...

Documentation

Overview

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

spamalot description here. writing documentation is no fun.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	*bolt.DB
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(db *bolt.DB) *Database

func (*Database) GetSentTransactionHashes

func (s *Database) GetSentTransactionHashes() ([]giota.Trytes, error)

Returns all sent transactions from the current run

func (*Database) GetTransactions

func (s *Database) GetTransactions(txns []giota.Trytes) ([]*giota.Transaction, error)

Gets the full transaction data for the supplied txns

func (*Database) GetUnconfirmedTransactionHashes added in v0.1.1

func (s *Database) GetUnconfirmedTransactionHashes() ([]giota.Trytes, error)

Returns all sent transactions from the current run

func (*Database) LogSentTransactions

func (s *Database) LogSentTransactions(txns []giota.Transaction)

func (*Database) RemoveConfirmedTransactions added in v0.1.1

func (s *Database) RemoveConfirmedTransactions(txns []giota.Trytes) error

Returns all sent transactions from the current run

func (*Database) StoreTransactions

func (s *Database) StoreTransactions(txns []giota.Transaction)

Save the transactions to the database cache

type Metric

type Metric struct {
	Kind MetricType  `json:"kind" bson:"kind"`
	Data interface{} `json:"data" bson:"data"`
}

type MetricType

type MetricType byte
const (
	INC_MILESTONE_BRANCH MetricType = iota
	INC_MILESTONE_TRUNK
	INC_BAD_TRUNK
	INC_BAD_BRANCH
	INC_BAD_TRUNK_AND_BRANCH
	INC_FAILED_TX
	INC_SUCCESSFUL_TX
	INC_NEW_CACHED_TX
	INC_GET_CACHED_TX
	INC_CONFIRMED_TX
	SET_CONFIRMATION_RATE
	SUMMARY
)

type Node

type Node struct {
	URL            string
	AttachToTangle bool
}

type Option

type Option func(*Spammer) error

func ToAddress

func ToAddress(addr string) Option

func WithCooldown

func WithCooldown(cooldown time.Duration) Option

func WithDatabase

func WithDatabase(db *Database) Option

func WithDepth

func WithDepth(depth int64) Option

func WithLocalPoW

func WithLocalPoW(localPoW bool) Option

func WithMWM

func WithMWM(mwm int64) Option

func WithMessage

func WithMessage(msg string) Option

func WithMessageMetrics

func WithMessageMetrics(m bool) Option

func WithMetricsRelay

func WithMetricsRelay(relay chan<- Metric) Option

func WithNode

func WithNode(node string, attachToTangle bool) Option

func WithNodes

func WithNodes(nodes []Node) Option

func WithPoW

func WithPoW(pow giota.PowFunc) Option

func WithSecurityLevel

func WithSecurityLevel(securityLvl SecurityLevel) Option

func WithStrategy

func WithStrategy(strategy string) Option

func WithTag

func WithTag(tag string) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

func WithVerboseLogging

func WithVerboseLogging(verboseLogging bool) Option

type SecurityLevel

type SecurityLevel byte
const (
	SECURITY_LVL_LOW    SecurityLevel = 1 // 81-trits (low)
	SECURITY_LVL_MEDIUM SecurityLevel = 2 // 162-trits (medium)
	SECURITY_LVL_HIGH   SecurityLevel = 3 // 243-trits (high)
)

type Spammer

type Spammer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New(options ...Option) (*Spammer, error)

func (*Spammer) Close

func (s *Spammer) Close() error

func (*Spammer) IsRunning

func (s *Spammer) IsRunning() bool

func (*Spammer) Start

func (s *Spammer) Start()

func (*Spammer) Stop

func (s *Spammer) Stop() error

func (*Spammer) UpdateConfirmedTransactions added in v0.1.1

func (s *Spammer) UpdateConfirmedTransactions() error

func (*Spammer) UpdateSettings

func (s *Spammer) UpdateSettings(options ...Option) error

type Summary

type Summary struct {
	TXsSucceeded      int     `json:"txs_succeeded"`
	TXsFailed         int     `json:"txs_failed"`
	BadBranch         int     `json:"bad_branch"`
	BadTrunk          int     `json:"bad_trunk"`
	BadTrunkAndBranch int     `json:"bad_trunk_and_branch"`
	MilestoneTrunk    int     `json:"milestone_trunk"`
	MilestoneBranch   int     `json:"milestone_branch"`
	TPS               float64 `json:"tps"`
	ErrorRate         float64 `json:"error_rate"`
	CachedTX          int     `json:"cached_tx"`
	RetrievedTX       int     `json:"new_tx"`
	ConfirmedTX       int     `json:"confirmed_tx"`
	ConfirmationRate  float64 `json:"confirmation_rate"`
}

type TXData

type TXData struct {
	Hash  giota.Trytes `json:"hash"`
	Count int          `json:"count"`
	Node  string       `json:"node"`
}

type Tips

type Tips struct {
	Trunk, Branch         giota.Transaction
	TrunkHash, BranchHash giota.Trytes
}

type Transaction

type Transaction struct {
	Trunk, Branch giota.Trytes
	Transactions  []giota.Transaction
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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