Documentation
¶
Index ¶
- Constants
- Variables
- type AbstractTx
- type Address
- type Batch
- type BatchChannel
- type BatchMessage
- type BatchReceiver
- type BatchSender
- type Binary
- type BinaryChannel
- type BinaryMessage
- type BinaryReceiver
- type BinarySender
- type BinaryState
- type Broadcaster
- type CStreamWrapper
- type CipherText
- type Coin
- type CoinGenerator
- type ConnHandler
- type ConnId
- type Connection
- type ConnectionPool
- type Contribution
- type DataChannel
- type DataMessage
- type DataReceiver
- type DataSender
- type DecryptionShare
- type DefaultTxQueueManager
- type DialOpts
- type Epoch
- type ErrHandler
- type GrpcClient
- type GrpcConnection
- func (conn *GrpcConnection) Close()
- func (conn *GrpcConnection) Handle(handler Handler)
- func (conn *GrpcConnection) Id() ConnId
- func (conn *GrpcConnection) Ip() Address
- func (conn *GrpcConnection) Send(msg pb.Message, successCallBack func(interface{}), errCallBack func(error))
- func (conn *GrpcConnection) Start() error
- type GrpcServer
- type Handler
- type HoneyBadger
- type MemCacheTracer
- type MemTxQueue
- type Member
- type MemberMap
- type Message
- type MessageEndpoint
- type PublicKey
- type Request
- type RequestRepository
- type ResultChannel
- type ResultMessage
- type ResultReceiver
- type ResultSender
- type SStreamWrapper
- type SecretKey
- type Stream
- type StreamWrapper
- type Tpke
- type Tracer
- type Transaction
- type TxQueue
- type TxQueueManager
- type TxValidator
Constants ¶
const (
DefaultDialTimeout = 3 * time.Second
)
Variables ¶
var ErrUndefinedRequestType = errors.New("unexpected request type")
Functions ¶
This section is empty.
Types ¶
type AbstractTx ¶
type AbstractTx map[string]interface{}
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
TODO: should be removed, after ACS merged TODO: ACS should use BatchMessage instead
func (*Batch) TxList ¶
func (batch *Batch) TxList() []Transaction
TxList is a function returns the transaction list on batch
type BatchChannel ¶
type BatchChannel struct {
// contains filtered or unexported fields
}
func NewBatchChannel ¶
func NewBatchChannel(size int) *BatchChannel
func (*BatchChannel) Receive ¶
func (c *BatchChannel) Receive() <-chan BatchMessage
func (*BatchChannel) Send ¶
func (c *BatchChannel) Send(msg BatchMessage)
type BatchMessage ¶
Batch is result of ACS set of contributions of at least n-f number of nodes. BatchMessage is used between ACS component and Honeybadger component.
After ACS done its own task for its epoch send BatchMessage to Honeybadger, then Honeybadger decrypt batch message.
type BatchReceiver ¶
type BatchReceiver interface {
Receive() <-chan BatchMessage
}
type BatchSender ¶
type BatchSender interface {
Send(msg BatchMessage)
}
type BinaryChannel ¶
type BinaryChannel struct {
// contains filtered or unexported fields
}
func NewBinaryChannel ¶
func NewBinaryChannel(size int) *BinaryChannel
func (*BinaryChannel) Receive ¶
func (c *BinaryChannel) Receive() <-chan BinaryMessage
func (*BinaryChannel) Send ¶
func (c *BinaryChannel) Send(msg BinaryMessage)
type BinaryMessage ¶
type BinaryReceiver ¶
type BinaryReceiver interface {
Receive() <-chan BinaryMessage
}
type BinarySender ¶
type BinarySender interface {
Send(msg BinaryMessage)
}
type BinaryState ¶
func NewBinaryState ¶
func NewBinaryState() *BinaryState
func (*BinaryState) Set ¶
func (b *BinaryState) Set(bin Binary)
func (*BinaryState) Undefined ¶
func (b *BinaryState) Undefined() bool
func (*BinaryState) Value ¶
func (b *BinaryState) Value() Binary
type Broadcaster ¶
type CStreamWrapper ¶
type CStreamWrapper struct {
// contains filtered or unexported fields
}
client side stream wrapper
func (*CStreamWrapper) Close ¶
func (csw *CStreamWrapper) Close()
func (*CStreamWrapper) GetStream ¶
func (csw *CStreamWrapper) GetStream() Stream
type CipherText ¶
type CipherText []byte
type CoinGenerator ¶
type ConnHandler ¶
type ConnHandler func(conn Connection)
type Connection ¶
type Connection interface { Send(msg pb.Message, successCallBack func(interface{}), errCallBack func(error)) Ip() Address Id() ConnId Close() Start() error Handle(handler Handler) }
func NewConnection ¶
func NewConnection(ip Address, id ConnId, streamWrapper StreamWrapper) (Connection, error)
type ConnectionPool ¶
type ConnectionPool struct {
// contains filtered or unexported fields
}
func NewConnectionPool ¶
func NewConnectionPool() *ConnectionPool
func (*ConnectionPool) Add ¶
func (p *ConnectionPool) Add(addr Address, conn Connection)
func (*ConnectionPool) DistributeMessage ¶
func (p *ConnectionPool) DistributeMessage(msgList []pb.Message)
func (*ConnectionPool) GetAll ¶
func (p *ConnectionPool) GetAll() []Connection
func (*ConnectionPool) Remove ¶
func (p *ConnectionPool) Remove(addr Address)
func (*ConnectionPool) ShareMessage ¶
func (p *ConnectionPool) ShareMessage(msg pb.Message)
type Contribution ¶
type Contribution struct {
TxList []Transaction
}
type DataChannel ¶
type DataChannel struct {
// contains filtered or unexported fields
}
func NewDataChannel ¶
func NewDataChannel(size int) *DataChannel
func (*DataChannel) Receive ¶
func (c *DataChannel) Receive() <-chan DataMessage
func (*DataChannel) Send ¶
func (c *DataChannel) Send(msg DataMessage)
type DataMessage ¶
type DataReceiver ¶
type DataReceiver interface {
Receive() <-chan DataMessage
}
type DataSender ¶
type DataSender interface {
Send(msg DataMessage)
}
type DecryptionShare ¶
type DecryptionShare [96]byte
type DefaultTxQueueManager ¶
type DefaultTxQueueManager struct {
// contains filtered or unexported fields
}
func NewDefaultTxQueueManager ¶
func NewDefaultTxQueueManager( txQueue TxQueue, hb HoneyBadger, contributionSize int, batchSize int, tryInterval time.Duration, txVerifier TxValidator, ) *DefaultTxQueueManager
func (*DefaultTxQueueManager) AddTransaction ¶
func (m *DefaultTxQueueManager) AddTransaction(tx Transaction) error
func (*DefaultTxQueueManager) Close ¶
func (m *DefaultTxQueueManager) Close()
type ErrHandler ¶
type ErrHandler func(err error)
type GrpcClient ¶
type GrpcClient struct{}
func NewClient ¶
func NewClient() *GrpcClient
func (GrpcClient) Dial ¶
func (c GrpcClient) Dial(opts DialOpts) (Connection, error)
type GrpcConnection ¶
func (*GrpcConnection) Close ¶
func (conn *GrpcConnection) Close()
func (*GrpcConnection) Handle ¶
func (conn *GrpcConnection) Handle(handler Handler)
func (*GrpcConnection) Id ¶
func (conn *GrpcConnection) Id() ConnId
func (*GrpcConnection) Ip ¶
func (conn *GrpcConnection) Ip() Address
func (*GrpcConnection) Send ¶
func (conn *GrpcConnection) Send(msg pb.Message, successCallBack func(interface{}), errCallBack func(error))
func (*GrpcConnection) Start ¶
func (conn *GrpcConnection) Start() error
type GrpcServer ¶
type GrpcServer struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(addr Address) *GrpcServer
func (*GrpcServer) Listen ¶
func (s *GrpcServer) Listen()
func (GrpcServer) MessageStream ¶
func (s GrpcServer) MessageStream(streamServer pb.StreamService_MessageStreamServer) error
MessageStream handle request to connection from remote peer. First, configure ip of remote peer, then based on that info create connection after that handler of server process handles that connection.
func (*GrpcServer) OnConn ¶
func (s *GrpcServer) OnConn(handler ConnHandler)
func (*GrpcServer) OnErr ¶
func (s *GrpcServer) OnErr(handler ErrHandler)
func (*GrpcServer) Stop ¶
func (s *GrpcServer) Stop()
type HoneyBadger ¶
type HoneyBadger interface { HandleContribution(contribution Contribution) HandleMessage(msg *pb.Message) error OnConsensus() bool }
type MemCacheTracer ¶
type MemCacheTracer struct {
// contains filtered or unexported fields
}
func NewMemCacheTracer ¶
func NewMemCacheTracer() *MemCacheTracer
func (*MemCacheTracer) Log ¶
func (t *MemCacheTracer) Log(keyvals ...string)
func (*MemCacheTracer) Trace ¶
func (t *MemCacheTracer) Trace()
type MemTxQueue ¶
memQueue defines transaction FIFO memQueue
func NewTxQueue ¶
func NewTxQueue() *MemTxQueue
func (*MemTxQueue) Poll ¶
func (q *MemTxQueue) Poll() (Transaction, error)
Poll returns first element of memQueue, and erase it.
func (*MemTxQueue) Push ¶
func (q *MemTxQueue) Push(tx Transaction)
Push adds transaction to memQueue.
type Member ¶
type Member struct {
Address Address
}
Member contains Node information who participate in the network
func NewMemberWithAddress ¶
type MemberMap ¶
type MemberMap struct {
// contains filtered or unexported fields
}
MemberMap manages members information
func NewMemberMap ¶
func NewMemberMap() *MemberMap
type MessageEndpoint ¶
type RequestRepository ¶
type ResultChannel ¶
type ResultChannel struct {
// contains filtered or unexported fields
}
func NewResultChannel ¶
func NewResultChannel(size int) *ResultChannel
func (*ResultChannel) Receive ¶
func (c *ResultChannel) Receive() <-chan ResultMessage
func (*ResultChannel) Send ¶
func (c *ResultChannel) Send(msg ResultMessage)
type ResultMessage ¶
type ResultMessage struct { Epoch Epoch Batch []AbstractTx }
ResultMessage is result of Honeybadger. When Honeybadger receive BatchMessage from ACS, it decrypt BatchMessage and use it to ResultMessage.Batch field.
Honeybadger knows what epoch of ACS done its task. and Honeybadger use that information of epoch and decrypted batch to create ResultMessage then send it back to application
type ResultReceiver ¶
type ResultReceiver interface {
Receive() <-chan ResultMessage
}
type ResultSender ¶
type ResultSender interface {
Send(msg ResultMessage)
}
type SStreamWrapper ¶
type SStreamWrapper struct { ServerStream pb.StreamService_MessageStreamServer // contains filtered or unexported fields }
server side stream wrapper
func (*SStreamWrapper) Close ¶
func (ssw *SStreamWrapper) Close()
func (*SStreamWrapper) GetStream ¶
func (ssw *SStreamWrapper) GetStream() Stream
type StreamWrapper ¶
func NewClientStreamWrapper ¶
func NewClientStreamWrapper(conn *grpc.ClientConn) (StreamWrapper, error)
func NewServerStreamWrapper ¶
func NewServerStreamWrapper(serverStream pb.StreamService_MessageStreamServer, cancel context.CancelFunc) StreamWrapper
type Tpke ¶
type Tpke interface { Encrypt(msg interface{}) ([]byte, error) Decrypt(enc []byte) ([]Transaction, error) }
type Transaction ¶
type Transaction interface{}
type TxQueue ¶
type TxQueue interface { Push(tx Transaction) Poll() (Transaction, error) Len() int }
type TxQueueManager ¶
type TxQueueManager interface {
AddTransaction(tx Transaction) error
}
TxQueueManager manages transaction queue. It receive transaction from client and TxQueueManager have its own policy to propose contribution to honeybadger
type TxValidator ¶
type TxValidator func(Transaction) bool