pool

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue struct {

	// You can subscribe to this channel to know whether queue is not empty
	NotEmpty chan struct{}
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue() *Queue

func (*Queue) Append

func (q *Queue) Append(elem interface{})

Adds one element at the back of the queue

func (*Queue) Back

func (q *Queue) Back() interface{}

Previews element at the back of queue

func (*Queue) Clean

func (q *Queue) Clean()

Removes all elements from queue

func (*Queue) Front

func (q *Queue) Front() interface{}

Previews element at the front of queue

func (*Queue) Length

func (q *Queue) Length() int

Returns the number of elements in queue

func (*Queue) Pop

func (q *Queue) Pop() interface{}

Pop removes and returns the element from the front of the queue. If the queue is empty, it will block

func (*Queue) Prepend

func (q *Queue) Prepend(elem interface{})

Adds one element at the front of queue

func (*Queue) Remove

func (q *Queue) Remove(elem interface{}) bool

Removes one element from the queue

type Receiver

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

Receiver represents the front door for the incoming transactions

func NewReceiver

func NewReceiver(p2p *p2p.P2P, maxTxsPerBlock int, maxTimeToGenerateBlock int) *Receiver

NewReceiver creates an instance of Receiver

func (*Receiver) Monitor

func (r *Receiver) Monitor()

Monitor creates a thread to monitor the transaction queue and generate block

func (*Receiver) Put

func (r *Receiver) Put(rawData []byte, collection string, pubKey []byte, signature []byte, permittedAddresses []string) (bool, map[string]string, []byte, error)

Put a transaction in JSON format to a collection. Returns isValidSig, fieldErrorMapping, transationId, error

func (*Receiver) PutWithoutSignature

func (r *Receiver) PutWithoutSignature(rawData []byte, collection string, permittedAddresses []string) (map[string]string, error)

PutWithoutSignature a transaction in JSON format to a collection. Returns fieldErrorMapping, transationId, error WARNING: this makes the document unverifiable

Jump to

Keyboard shortcuts

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