Documentation ¶
Index ¶
- Constants
- func NewConsensus(ledger ledger.Ledger, addr *address.Address) *consensus
- func RegisterConsensusServer(s *grpc.Server, srv ConsensusServer)
- type AcceptRequest
- func (*AcceptRequest) Descriptor() ([]byte, []int)
- func (m *AcceptRequest) GetReceiveTx() *ledger.Transaction
- func (m *AcceptRequest) GetSendTx() *ledger.Transaction
- func (m *AcceptRequest) GetVotes() []*Vote
- func (*AcceptRequest) ProtoMessage()
- func (m *AcceptRequest) Reset()
- func (m *AcceptRequest) String() string
- func (m *AcceptRequest) XXX_DiscardUnknown()
- func (m *AcceptRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *AcceptRequest) XXX_Merge(src proto.Message)
- func (m *AcceptRequest) XXX_Size() int
- func (m *AcceptRequest) XXX_Unmarshal(b []byte) error
- type AcceptResult
- func (*AcceptResult) Descriptor() ([]byte, []int)
- func (*AcceptResult) ProtoMessage()
- func (m *AcceptResult) Reset()
- func (m *AcceptResult) String() string
- func (m *AcceptResult) XXX_DiscardUnknown()
- func (m *AcceptResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *AcceptResult) XXX_Merge(src proto.Message)
- func (m *AcceptResult) XXX_Size() int
- func (m *AcceptResult) XXX_Unmarshal(b []byte) error
- type Consensus
- type ConsensusClient
- type ConsensusServer
- type Vote
- func (*Vote) Descriptor() ([]byte, []int)
- func (m *Vote) GetOk() bool
- func (m *Vote) GetPubKey() []byte
- func (m *Vote) GetReason() string
- func (m *Vote) GetSignature() []byte
- func (m *Vote) Hash() []byte
- func (*Vote) ProtoMessage()
- func (m *Vote) Reset()
- func (m *Vote) Sign(privateKey *ecdsa.PrivateKey) error
- func (m *Vote) String() string
- func (m *Vote) XXX_DiscardUnknown()
- func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Vote) XXX_Merge(src proto.Message)
- func (m *Vote) XXX_Size() int
- func (m *Vote) XXX_Unmarshal(b []byte) error
- type VoteRequest
- func (*VoteRequest) Descriptor() ([]byte, []int)
- func (m *VoteRequest) GetReceiveTx() *ledger.Transaction
- func (m *VoteRequest) GetSendTx() *ledger.Transaction
- func (*VoteRequest) ProtoMessage()
- func (m *VoteRequest) Reset()
- func (m *VoteRequest) String() string
- func (m *VoteRequest) XXX_DiscardUnknown()
- func (m *VoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *VoteRequest) XXX_Merge(src proto.Message)
- func (m *VoteRequest) XXX_Size() int
- func (m *VoteRequest) XXX_Unmarshal(b []byte) error
- type VoteResult
- func (*VoteResult) Descriptor() ([]byte, []int)
- func (m *VoteResult) GetVote() *Vote
- func (*VoteResult) ProtoMessage()
- func (m *VoteResult) Reset()
- func (m *VoteResult) String() string
- func (m *VoteResult) XXX_DiscardUnknown()
- func (m *VoteResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *VoteResult) XXX_Merge(src proto.Message)
- func (m *VoteResult) XXX_Size() int
- func (m *VoteResult) XXX_Unmarshal(b []byte) error
Constants ¶
View Source
const (
ErrInvalidVotingResult = errors.Error("invalid voting result")
)
Variables ¶
This section is empty.
Functions ¶
func RegisterConsensusServer ¶
func RegisterConsensusServer(s *grpc.Server, srv ConsensusServer)
Types ¶
type AcceptRequest ¶
type AcceptRequest struct { SendTx *ledger.Transaction `protobuf:"bytes,1,opt,name=sendTx,proto3" json:"sendTx,omitempty"` ReceiveTx *ledger.Transaction `protobuf:"bytes,2,opt,name=receiveTx,proto3" json:"receiveTx,omitempty"` Votes []*Vote `protobuf:"bytes,3,rep,name=votes,proto3" json:"votes,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*AcceptRequest) Descriptor ¶
func (*AcceptRequest) Descriptor() ([]byte, []int)
func (*AcceptRequest) GetReceiveTx ¶
func (m *AcceptRequest) GetReceiveTx() *ledger.Transaction
func (*AcceptRequest) GetSendTx ¶
func (m *AcceptRequest) GetSendTx() *ledger.Transaction
func (*AcceptRequest) GetVotes ¶
func (m *AcceptRequest) GetVotes() []*Vote
func (*AcceptRequest) ProtoMessage ¶
func (*AcceptRequest) ProtoMessage()
func (*AcceptRequest) Reset ¶
func (m *AcceptRequest) Reset()
func (*AcceptRequest) String ¶
func (m *AcceptRequest) String() string
func (*AcceptRequest) XXX_DiscardUnknown ¶
func (m *AcceptRequest) XXX_DiscardUnknown()
func (*AcceptRequest) XXX_Marshal ¶
func (m *AcceptRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AcceptRequest) XXX_Merge ¶
func (dst *AcceptRequest) XXX_Merge(src proto.Message)
func (*AcceptRequest) XXX_Size ¶
func (m *AcceptRequest) XXX_Size() int
func (*AcceptRequest) XXX_Unmarshal ¶
func (m *AcceptRequest) XXX_Unmarshal(b []byte) error
type AcceptResult ¶
type AcceptResult struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*AcceptResult) Descriptor ¶
func (*AcceptResult) Descriptor() ([]byte, []int)
func (*AcceptResult) ProtoMessage ¶
func (*AcceptResult) ProtoMessage()
func (*AcceptResult) Reset ¶
func (m *AcceptResult) Reset()
func (*AcceptResult) String ¶
func (m *AcceptResult) String() string
func (*AcceptResult) XXX_DiscardUnknown ¶
func (m *AcceptResult) XXX_DiscardUnknown()
func (*AcceptResult) XXX_Marshal ¶
func (m *AcceptResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AcceptResult) XXX_Merge ¶
func (dst *AcceptResult) XXX_Merge(src proto.Message)
func (*AcceptResult) XXX_Size ¶
func (m *AcceptResult) XXX_Size() int
func (*AcceptResult) XXX_Unmarshal ¶
func (m *AcceptResult) XXX_Unmarshal(b []byte) error
type Consensus ¶
type Consensus interface { Vote(*VoteRequest) (*VoteResult, error) Accept(*AcceptRequest) (*AcceptResult, error) }
type ConsensusClient ¶
type ConsensusClient interface { Vote(ctx context.Context, in *VoteRequest, opts ...grpc.CallOption) (*VoteResult, error) Accept(ctx context.Context, in *AcceptRequest, opts ...grpc.CallOption) (*AcceptResult, error) }
ConsensusClient is the client API for Consensus service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewConsensusClient ¶
func NewConsensusClient(cc *grpc.ClientConn) ConsensusClient
type ConsensusServer ¶
type ConsensusServer interface { Vote(context.Context, *VoteRequest) (*VoteResult, error) Accept(context.Context, *AcceptRequest) (*AcceptResult, error) }
ConsensusServer is the server API for Consensus service.
type Vote ¶
type Vote struct { Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` PubKey []byte `protobuf:"bytes,3,opt,name=pubKey,proto3" json:"pubKey,omitempty"` Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Vote) Descriptor ¶
func (*Vote) GetSignature ¶
func (*Vote) ProtoMessage ¶
func (*Vote) ProtoMessage()
func (*Vote) XXX_DiscardUnknown ¶
func (m *Vote) XXX_DiscardUnknown()
func (*Vote) XXX_Unmarshal ¶
type VoteRequest ¶
type VoteRequest struct { SendTx *ledger.Transaction `protobuf:"bytes,1,opt,name=sendTx,proto3" json:"sendTx,omitempty"` ReceiveTx *ledger.Transaction `protobuf:"bytes,2,opt,name=receiveTx,proto3" json:"receiveTx,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*VoteRequest) Descriptor ¶
func (*VoteRequest) Descriptor() ([]byte, []int)
func (*VoteRequest) GetReceiveTx ¶
func (m *VoteRequest) GetReceiveTx() *ledger.Transaction
func (*VoteRequest) GetSendTx ¶
func (m *VoteRequest) GetSendTx() *ledger.Transaction
func (*VoteRequest) ProtoMessage ¶
func (*VoteRequest) ProtoMessage()
func (*VoteRequest) Reset ¶
func (m *VoteRequest) Reset()
func (*VoteRequest) String ¶
func (m *VoteRequest) String() string
func (*VoteRequest) XXX_DiscardUnknown ¶
func (m *VoteRequest) XXX_DiscardUnknown()
func (*VoteRequest) XXX_Marshal ¶
func (m *VoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*VoteRequest) XXX_Merge ¶
func (dst *VoteRequest) XXX_Merge(src proto.Message)
func (*VoteRequest) XXX_Size ¶
func (m *VoteRequest) XXX_Size() int
func (*VoteRequest) XXX_Unmarshal ¶
func (m *VoteRequest) XXX_Unmarshal(b []byte) error
type VoteResult ¶
type VoteResult struct { Vote *Vote `protobuf:"bytes,1,opt,name=vote,proto3" json:"vote,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*VoteResult) Descriptor ¶
func (*VoteResult) Descriptor() ([]byte, []int)
func (*VoteResult) GetVote ¶
func (m *VoteResult) GetVote() *Vote
func (*VoteResult) ProtoMessage ¶
func (*VoteResult) ProtoMessage()
func (*VoteResult) Reset ¶
func (m *VoteResult) Reset()
func (*VoteResult) String ¶
func (m *VoteResult) String() string
func (*VoteResult) XXX_DiscardUnknown ¶
func (m *VoteResult) XXX_DiscardUnknown()
func (*VoteResult) XXX_Marshal ¶
func (m *VoteResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*VoteResult) XXX_Merge ¶
func (dst *VoteResult) XXX_Merge(src proto.Message)
func (*VoteResult) XXX_Size ¶
func (m *VoteResult) XXX_Size() int
func (*VoteResult) XXX_Unmarshal ¶
func (m *VoteResult) XXX_Unmarshal(b []byte) error
Click to show internal directories.
Click to hide internal directories.