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 (*Queue) Append ¶
func (q *Queue) Append(elem interface{})
Adds one element at the back of the 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
type Receiver ¶
type Receiver struct {
// contains filtered or unexported fields
}
Receiver represents the front door for the incoming transactions
func NewReceiver ¶
func NewReceiver(bc *blockchain.Blockchain, 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
Click to show internal directories.
Click to hide internal directories.