Documentation
¶
Overview ¶
Package tenvis is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterTenvisHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterTenvisHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TenvisClient) error
- func RegisterTenvisHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterTenvisServer(s *grpc.Server, srv TenvisServer)
- type Broadcaster
- type Config
- type CreateVotingOperation
- func (*CreateVotingOperation) Descriptor() ([]byte, []int)
- func (m *CreateVotingOperation) GetOptions() []string
- func (m *CreateVotingOperation) GetOrganizer() string
- func (m *CreateVotingOperation) GetParticipants() []string
- func (m *CreateVotingOperation) GetSignature() []byte
- func (m *CreateVotingOperation) GetTitle() string
- func (*CreateVotingOperation) ProtoMessage()
- func (m *CreateVotingOperation) Reset()
- func (m *CreateVotingOperation) String() string
- func (m *CreateVotingOperation) XXX_DiscardUnknown()
- func (m *CreateVotingOperation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CreateVotingOperation) XXX_Merge(src proto.Message)
- func (m *CreateVotingOperation) XXX_Size() int
- func (m *CreateVotingOperation) XXX_Unmarshal(b []byte) error
- type GetLedgerRequest
- func (*GetLedgerRequest) Descriptor() ([]byte, []int)
- func (m *GetLedgerRequest) GetIndex() uint64
- func (*GetLedgerRequest) ProtoMessage()
- func (m *GetLedgerRequest) Reset()
- func (m *GetLedgerRequest) String() string
- func (m *GetLedgerRequest) XXX_DiscardUnknown()
- func (m *GetLedgerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GetLedgerRequest) XXX_Merge(src proto.Message)
- func (m *GetLedgerRequest) XXX_Size() int
- func (m *GetLedgerRequest) XXX_Unmarshal(b []byte) error
- type GetVotingRequest
- func (*GetVotingRequest) Descriptor() ([]byte, []int)
- func (m *GetVotingRequest) GetId() uint64
- func (*GetVotingRequest) ProtoMessage()
- func (m *GetVotingRequest) Reset()
- func (m *GetVotingRequest) String() string
- func (m *GetVotingRequest) XXX_DiscardUnknown()
- func (m *GetVotingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GetVotingRequest) XXX_Merge(src proto.Message)
- func (m *GetVotingRequest) XXX_Size() int
- func (m *GetVotingRequest) XXX_Unmarshal(b []byte) error
- type Ledger
- func (*Ledger) Descriptor() ([]byte, []int)
- func (m *Ledger) GetIndex() uint64
- func (m *Ledger) GetValue() []byte
- func (*Ledger) ProtoMessage()
- func (m *Ledger) Reset()
- func (m *Ledger) String() string
- func (m *Ledger) XXX_DiscardUnknown()
- func (m *Ledger) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Ledger) XXX_Merge(src proto.Message)
- func (m *Ledger) XXX_Size() int
- func (m *Ledger) XXX_Unmarshal(b []byte) error
- type LedgerMessage
- func (*LedgerMessage) Descriptor() ([]byte, []int)
- func (m *LedgerMessage) GetLedger() *Ledger
- func (m *LedgerMessage) GetSignature() []byte
- func (*LedgerMessage) ProtoMessage()
- func (m *LedgerMessage) Reset()
- func (m *LedgerMessage) String() string
- func (m *LedgerMessage) XXX_DiscardUnknown()
- func (m *LedgerMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *LedgerMessage) XXX_Merge(src proto.Message)
- func (m *LedgerMessage) XXX_Size() int
- func (m *LedgerMessage) XXX_Unmarshal(b []byte) error
- type Listener
- type Node
- func (n *Node) CombineValues(values ...scp.Value) scp.Value
- func (n *Node) CreateVoting(ctx context.Context, op *CreateVotingOperation) (*Voting, error)
- func (n *Node) GetVoting(ctx context.Context, req *GetVotingRequest) (*Voting, error)
- func (n *Node) LoadSlots(from uint64, to scp.Slot) (slots []scp.Slot)
- func (n *Node) PersistSlot(s scp.Slot)
- func (n *Node) Run()
- func (n *Node) ValidateValue(v scp.Value) bool
- func (n *Node) Vote(ctx context.Context, op *VoteOperation) (*Voting, error)
- type PrivateKey
- type PublicKey
- type SCPMessage
- func (*SCPMessage) Descriptor() ([]byte, []int)
- func (m *SCPMessage) GetCounter() uint32
- func (m *SCPMessage) GetSlotIndex() uint64
- func (m *SCPMessage) GetType() SCPMessage_Type
- func (m *SCPMessage) GetValue() []byte
- func (*SCPMessage) ProtoMessage()
- func (m *SCPMessage) Reset()
- func (m *SCPMessage) String() string
- func (m *SCPMessage) XXX_DiscardUnknown()
- func (m *SCPMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SCPMessage) XXX_Merge(src proto.Message)
- func (m *SCPMessage) XXX_Size() int
- func (m *SCPMessage) XXX_Unmarshal(b []byte) error
- type SCPMessage_Type
- type SCPMessages
- func (*SCPMessages) Descriptor() ([]byte, []int)
- func (m *SCPMessages) GetList() []*SCPMessage
- func (m *SCPMessages) GetSignature() []byte
- func (*SCPMessages) ProtoMessage()
- func (m *SCPMessages) Reset()
- func (m *SCPMessages) String() string
- func (m *SCPMessages) XXX_DiscardUnknown()
- func (m *SCPMessages) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SCPMessages) XXX_Merge(src proto.Message)
- func (m *SCPMessages) XXX_Size() int
- func (m *SCPMessages) XXX_Unmarshal(b []byte) error
- type Storage
- func (s *Storage) GetLastLedgerIndex() (uint64, error)
- func (s *Storage) GetLastVotingID() (uint64, error)
- func (s *Storage) GetLedger(id uint64) (*Ledger, error)
- func (s *Storage) GetVoting(id uint64) (*Voting, error)
- func (s *Storage) SetLedger(l *Ledger) error
- func (s *Storage) SetVoting(v *Voting) error
- func (s *Storage) UpdateVoting(v *Voting) error
- type Streaming
- type TenvisClient
- type TenvisOperations
- func (*TenvisOperations) Descriptor() ([]byte, []int)
- func (m *TenvisOperations) GetCreateVoting() []*CreateVotingOperation
- func (m *TenvisOperations) GetVote() []*VoteOperation
- func (*TenvisOperations) ProtoMessage()
- func (m *TenvisOperations) Reset()
- func (m *TenvisOperations) String() string
- func (m *TenvisOperations) XXX_DiscardUnknown()
- func (m *TenvisOperations) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TenvisOperations) XXX_Merge(src proto.Message)
- func (m *TenvisOperations) XXX_Size() int
- func (m *TenvisOperations) XXX_Unmarshal(b []byte) error
- type TenvisServer
- type Tenvis_StreamSCPMessagesClient
- type Tenvis_StreamSCPMessagesServer
- type UnimplementedTenvisServer
- func (*UnimplementedTenvisServer) CreateVoting(ctx context.Context, req *CreateVotingOperation) (*Voting, error)
- func (*UnimplementedTenvisServer) GetLedger(ctx context.Context, req *GetLedgerRequest) (*LedgerMessage, error)
- func (*UnimplementedTenvisServer) GetVoting(ctx context.Context, req *GetVotingRequest) (*Voting, error)
- func (*UnimplementedTenvisServer) StreamSCPMessages(req *empty.Empty, srv Tenvis_StreamSCPMessagesServer) error
- func (*UnimplementedTenvisServer) Vote(ctx context.Context, req *VoteOperation) (*Voting, error)
- type VoteOperation
- func (*VoteOperation) Descriptor() ([]byte, []int)
- func (m *VoteOperation) GetOption() string
- func (m *VoteOperation) GetParticipantId() string
- func (m *VoteOperation) GetSignature() []byte
- func (m *VoteOperation) GetVotingId() uint64
- func (*VoteOperation) ProtoMessage()
- func (m *VoteOperation) Reset()
- func (m *VoteOperation) String() string
- func (m *VoteOperation) XXX_DiscardUnknown()
- func (m *VoteOperation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *VoteOperation) XXX_Merge(src proto.Message)
- func (m *VoteOperation) XXX_Size() int
- func (m *VoteOperation) XXX_Unmarshal(b []byte) error
- type Voting
- func (*Voting) Descriptor() ([]byte, []int)
- func (m *Voting) GetId() uint64
- func (m *Voting) GetOptions() map[string]uint32
- func (m *Voting) GetOrganizer() string
- func (m *Voting) GetParticipants() []string
- func (m *Voting) GetResult() string
- func (m *Voting) GetTitle() string
- func (m *Voting) GetVoted() []string
- func (*Voting) ProtoMessage()
- func (m *Voting) Reset()
- func (m *Voting) String() string
- func (m *Voting) XXX_DiscardUnknown()
- func (m *Voting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Voting) XXX_Merge(src proto.Message)
- func (m *Voting) XXX_Size() int
- func (m *Voting) XXX_Unmarshal(b []byte) error
Constants ¶
const ( VotingKey = "voting" VotingSerialKey = "voting_serial" LedgersKey = "ledgers" LedgerSerialKey = "ledger_serial" )
Variables ¶
var SCPMessage_Type_name = map[int32]string{
0: "UNKNOWN",
1: "VOTE_NOMINATE",
2: "ACCEPT_NOMINATE",
3: "VOTE_PREPARE",
4: "ACCEPT_PREPARE",
5: "VOTE_COMMIT",
6: "ACCEPT_COMMIT",
}
var SCPMessage_Type_value = map[string]int32{
"UNKNOWN": 0,
"VOTE_NOMINATE": 1,
"ACCEPT_NOMINATE": 2,
"VOTE_PREPARE": 3,
"ACCEPT_PREPARE": 4,
"VOTE_COMMIT": 5,
"ACCEPT_COMMIT": 6,
}
Functions ¶
func RegisterTenvisHandler ¶
RegisterTenvisHandler registers the http handlers for service Tenvis to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterTenvisHandlerClient ¶
func RegisterTenvisHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TenvisClient) error
RegisterTenvisHandlerClient registers the http handlers for service Tenvis to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TenvisClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TenvisClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "TenvisClient" to call the correct interceptors.
func RegisterTenvisHandlerFromEndpoint ¶
func RegisterTenvisHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterTenvisHandlerFromEndpoint is same as RegisterTenvisHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterTenvisServer ¶
func RegisterTenvisServer(s *grpc.Server, srv TenvisServer)
Types ¶
type Broadcaster ¶
type Broadcaster struct {
// contains filtered or unexported fields
}
func NewBroadcaster ¶
func NewBroadcaster(key PrivateKey, storage Storage) *Broadcaster
func (*Broadcaster) GetLedger ¶
func (b *Broadcaster) GetLedger(ctx context.Context, req *GetLedgerRequest) (*LedgerMessage, error)
func (*Broadcaster) StreamSCPMessages ¶
func (b *Broadcaster) StreamSCPMessages(req *empty.Empty, stream Tenvis_StreamSCPMessagesServer) error
type Config ¶
type Config struct {
Redis *redis.Client
Key PrivateKey
Peers map[string]PublicKey
QuorumSlice *scp.QuorumSlice
}
type CreateVotingOperation ¶
type CreateVotingOperation struct {
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
Organizer string `protobuf:"bytes,2,opt,name=organizer,proto3" json:"organizer,omitempty"`
Participants []string `protobuf:"bytes,3,rep,name=participants,proto3" json:"participants,omitempty"`
Options []string `protobuf:"bytes,4,rep,name=options,proto3" json:"options,omitempty"`
Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*CreateVotingOperation) Descriptor ¶
func (*CreateVotingOperation) Descriptor() ([]byte, []int)
func (*CreateVotingOperation) GetOptions ¶
func (m *CreateVotingOperation) GetOptions() []string
func (*CreateVotingOperation) GetOrganizer ¶
func (m *CreateVotingOperation) GetOrganizer() string
func (*CreateVotingOperation) GetParticipants ¶
func (m *CreateVotingOperation) GetParticipants() []string
func (*CreateVotingOperation) GetSignature ¶
func (m *CreateVotingOperation) GetSignature() []byte
func (*CreateVotingOperation) GetTitle ¶
func (m *CreateVotingOperation) GetTitle() string
func (*CreateVotingOperation) ProtoMessage ¶
func (*CreateVotingOperation) ProtoMessage()
func (*CreateVotingOperation) Reset ¶
func (m *CreateVotingOperation) Reset()
func (*CreateVotingOperation) String ¶
func (m *CreateVotingOperation) String() string
func (*CreateVotingOperation) XXX_DiscardUnknown ¶
func (m *CreateVotingOperation) XXX_DiscardUnknown()
func (*CreateVotingOperation) XXX_Marshal ¶
func (m *CreateVotingOperation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CreateVotingOperation) XXX_Merge ¶
func (m *CreateVotingOperation) XXX_Merge(src proto.Message)
func (*CreateVotingOperation) XXX_Size ¶
func (m *CreateVotingOperation) XXX_Size() int
func (*CreateVotingOperation) XXX_Unmarshal ¶
func (m *CreateVotingOperation) XXX_Unmarshal(b []byte) error
type GetLedgerRequest ¶
type GetLedgerRequest struct {
Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*GetLedgerRequest) Descriptor ¶
func (*GetLedgerRequest) Descriptor() ([]byte, []int)
func (*GetLedgerRequest) GetIndex ¶
func (m *GetLedgerRequest) GetIndex() uint64
func (*GetLedgerRequest) ProtoMessage ¶
func (*GetLedgerRequest) ProtoMessage()
func (*GetLedgerRequest) Reset ¶
func (m *GetLedgerRequest) Reset()
func (*GetLedgerRequest) String ¶
func (m *GetLedgerRequest) String() string
func (*GetLedgerRequest) XXX_DiscardUnknown ¶
func (m *GetLedgerRequest) XXX_DiscardUnknown()
func (*GetLedgerRequest) XXX_Marshal ¶
func (m *GetLedgerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GetLedgerRequest) XXX_Merge ¶
func (m *GetLedgerRequest) XXX_Merge(src proto.Message)
func (*GetLedgerRequest) XXX_Size ¶
func (m *GetLedgerRequest) XXX_Size() int
func (*GetLedgerRequest) XXX_Unmarshal ¶
func (m *GetLedgerRequest) XXX_Unmarshal(b []byte) error
type GetVotingRequest ¶
type GetVotingRequest struct {
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*GetVotingRequest) Descriptor ¶
func (*GetVotingRequest) Descriptor() ([]byte, []int)
func (*GetVotingRequest) GetId ¶
func (m *GetVotingRequest) GetId() uint64
func (*GetVotingRequest) ProtoMessage ¶
func (*GetVotingRequest) ProtoMessage()
func (*GetVotingRequest) Reset ¶
func (m *GetVotingRequest) Reset()
func (*GetVotingRequest) String ¶
func (m *GetVotingRequest) String() string
func (*GetVotingRequest) XXX_DiscardUnknown ¶
func (m *GetVotingRequest) XXX_DiscardUnknown()
func (*GetVotingRequest) XXX_Marshal ¶
func (m *GetVotingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GetVotingRequest) XXX_Merge ¶
func (m *GetVotingRequest) XXX_Merge(src proto.Message)
func (*GetVotingRequest) XXX_Size ¶
func (m *GetVotingRequest) XXX_Size() int
func (*GetVotingRequest) XXX_Unmarshal ¶
func (m *GetVotingRequest) XXX_Unmarshal(b []byte) error
type Ledger ¶
type Ledger struct {
Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*Ledger) Descriptor ¶
func (*Ledger) ProtoMessage ¶
func (*Ledger) ProtoMessage()
func (*Ledger) XXX_DiscardUnknown ¶
func (m *Ledger) XXX_DiscardUnknown()
func (*Ledger) XXX_Marshal ¶
func (*Ledger) XXX_Unmarshal ¶
type LedgerMessage ¶
type LedgerMessage struct {
Ledger *Ledger `protobuf:"bytes,1,opt,name=ledger,proto3" json:"ledger,omitempty"`
Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*LedgerMessage) Descriptor ¶
func (*LedgerMessage) Descriptor() ([]byte, []int)
func (*LedgerMessage) GetLedger ¶
func (m *LedgerMessage) GetLedger() *Ledger
func (*LedgerMessage) GetSignature ¶
func (m *LedgerMessage) GetSignature() []byte
func (*LedgerMessage) ProtoMessage ¶
func (*LedgerMessage) ProtoMessage()
func (*LedgerMessage) Reset ¶
func (m *LedgerMessage) Reset()
func (*LedgerMessage) String ¶
func (m *LedgerMessage) String() string
func (*LedgerMessage) XXX_DiscardUnknown ¶
func (m *LedgerMessage) XXX_DiscardUnknown()
func (*LedgerMessage) XXX_Marshal ¶
func (m *LedgerMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*LedgerMessage) XXX_Merge ¶
func (m *LedgerMessage) XXX_Merge(src proto.Message)
func (*LedgerMessage) XXX_Size ¶
func (m *LedgerMessage) XXX_Size() int
func (*LedgerMessage) XXX_Unmarshal ¶
func (m *LedgerMessage) XXX_Unmarshal(b []byte) error
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
func NewListener ¶
type Node ¶
type Node struct {
Streaming
// contains filtered or unexported fields
}
func (*Node) CreateVoting ¶
func (*Node) PersistSlot ¶
type PrivateKey ¶
type SCPMessage ¶
type SCPMessage struct {
Type SCPMessage_Type `protobuf:"varint,1,opt,name=type,proto3,enum=tenvis.SCPMessage_Type" json:"type,omitempty"`
SlotIndex uint64 `protobuf:"varint,2,opt,name=slot_index,json=slotIndex,proto3" json:"slot_index,omitempty"`
Counter uint32 `protobuf:"varint,3,opt,name=counter,proto3" json:"counter,omitempty"`
Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*SCPMessage) Descriptor ¶
func (*SCPMessage) Descriptor() ([]byte, []int)
func (*SCPMessage) GetCounter ¶
func (m *SCPMessage) GetCounter() uint32
func (*SCPMessage) GetSlotIndex ¶
func (m *SCPMessage) GetSlotIndex() uint64
func (*SCPMessage) GetType ¶
func (m *SCPMessage) GetType() SCPMessage_Type
func (*SCPMessage) GetValue ¶
func (m *SCPMessage) GetValue() []byte
func (*SCPMessage) ProtoMessage ¶
func (*SCPMessage) ProtoMessage()
func (*SCPMessage) Reset ¶
func (m *SCPMessage) Reset()
func (*SCPMessage) String ¶
func (m *SCPMessage) String() string
func (*SCPMessage) XXX_DiscardUnknown ¶
func (m *SCPMessage) XXX_DiscardUnknown()
func (*SCPMessage) XXX_Marshal ¶
func (m *SCPMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SCPMessage) XXX_Merge ¶
func (m *SCPMessage) XXX_Merge(src proto.Message)
func (*SCPMessage) XXX_Size ¶
func (m *SCPMessage) XXX_Size() int
func (*SCPMessage) XXX_Unmarshal ¶
func (m *SCPMessage) XXX_Unmarshal(b []byte) error
type SCPMessage_Type ¶
type SCPMessage_Type int32
const ( SCPMessage_UNKNOWN SCPMessage_Type = 0 SCPMessage_VOTE_NOMINATE SCPMessage_Type = 1 SCPMessage_ACCEPT_NOMINATE SCPMessage_Type = 2 SCPMessage_VOTE_PREPARE SCPMessage_Type = 3 SCPMessage_ACCEPT_PREPARE SCPMessage_Type = 4 SCPMessage_VOTE_COMMIT SCPMessage_Type = 5 SCPMessage_ACCEPT_COMMIT SCPMessage_Type = 6 )
func (SCPMessage_Type) EnumDescriptor ¶
func (SCPMessage_Type) EnumDescriptor() ([]byte, []int)
func (SCPMessage_Type) String ¶
func (x SCPMessage_Type) String() string
type SCPMessages ¶
type SCPMessages struct {
List []*SCPMessage `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"`
Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*SCPMessages) Descriptor ¶
func (*SCPMessages) Descriptor() ([]byte, []int)
func (*SCPMessages) GetList ¶
func (m *SCPMessages) GetList() []*SCPMessage
func (*SCPMessages) GetSignature ¶
func (m *SCPMessages) GetSignature() []byte
func (*SCPMessages) ProtoMessage ¶
func (*SCPMessages) ProtoMessage()
func (*SCPMessages) Reset ¶
func (m *SCPMessages) Reset()
func (*SCPMessages) String ¶
func (m *SCPMessages) String() string
func (*SCPMessages) XXX_DiscardUnknown ¶
func (m *SCPMessages) XXX_DiscardUnknown()
func (*SCPMessages) XXX_Marshal ¶
func (m *SCPMessages) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SCPMessages) XXX_Merge ¶
func (m *SCPMessages) XXX_Merge(src proto.Message)
func (*SCPMessages) XXX_Size ¶
func (m *SCPMessages) XXX_Size() int
func (*SCPMessages) XXX_Unmarshal ¶
func (m *SCPMessages) XXX_Unmarshal(b []byte) error
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func (*Storage) GetLastLedgerIndex ¶
func (*Storage) GetLastVotingID ¶
func (*Storage) UpdateVoting ¶
type Streaming ¶
type Streaming struct {
Listener
Broadcaster
}
func NewStreaming ¶
func NewStreaming(key PrivateKey, addresses map[string]PublicKey, storage Storage) *Streaming
func (*Streaming) GetLedger ¶
func (s *Streaming) GetLedger(ctx context.Context, req *GetLedgerRequest) (*LedgerMessage, error)
type TenvisClient ¶
type TenvisClient interface {
StreamSCPMessages(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (Tenvis_StreamSCPMessagesClient, error)
GetLedger(ctx context.Context, in *GetLedgerRequest, opts ...grpc.CallOption) (*LedgerMessage, error)
GetVoting(ctx context.Context, in *GetVotingRequest, opts ...grpc.CallOption) (*Voting, error)
CreateVoting(ctx context.Context, in *CreateVotingOperation, opts ...grpc.CallOption) (*Voting, error)
Vote(ctx context.Context, in *VoteOperation, opts ...grpc.CallOption) (*Voting, error)
}
TenvisClient is the client API for Tenvis service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewTenvisClient ¶
func NewTenvisClient(cc *grpc.ClientConn) TenvisClient
type TenvisOperations ¶
type TenvisOperations struct {
CreateVoting []*CreateVotingOperation `protobuf:"bytes,2,rep,name=create_voting,json=createVoting,proto3" json:"create_voting,omitempty"`
Vote []*VoteOperation `protobuf:"bytes,3,rep,name=vote,proto3" json:"vote,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*TenvisOperations) Descriptor ¶
func (*TenvisOperations) Descriptor() ([]byte, []int)
func (*TenvisOperations) GetCreateVoting ¶
func (m *TenvisOperations) GetCreateVoting() []*CreateVotingOperation
func (*TenvisOperations) GetVote ¶
func (m *TenvisOperations) GetVote() []*VoteOperation
func (*TenvisOperations) ProtoMessage ¶
func (*TenvisOperations) ProtoMessage()
func (*TenvisOperations) Reset ¶
func (m *TenvisOperations) Reset()
func (*TenvisOperations) String ¶
func (m *TenvisOperations) String() string
func (*TenvisOperations) XXX_DiscardUnknown ¶
func (m *TenvisOperations) XXX_DiscardUnknown()
func (*TenvisOperations) XXX_Marshal ¶
func (m *TenvisOperations) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*TenvisOperations) XXX_Merge ¶
func (m *TenvisOperations) XXX_Merge(src proto.Message)
func (*TenvisOperations) XXX_Size ¶
func (m *TenvisOperations) XXX_Size() int
func (*TenvisOperations) XXX_Unmarshal ¶
func (m *TenvisOperations) XXX_Unmarshal(b []byte) error
type TenvisServer ¶
type TenvisServer interface {
StreamSCPMessages(*empty.Empty, Tenvis_StreamSCPMessagesServer) error
GetLedger(context.Context, *GetLedgerRequest) (*LedgerMessage, error)
GetVoting(context.Context, *GetVotingRequest) (*Voting, error)
CreateVoting(context.Context, *CreateVotingOperation) (*Voting, error)
Vote(context.Context, *VoteOperation) (*Voting, error)
}
TenvisServer is the server API for Tenvis service.
type Tenvis_StreamSCPMessagesClient ¶
type Tenvis_StreamSCPMessagesClient interface {
Recv() (*SCPMessages, error)
grpc.ClientStream
}
type Tenvis_StreamSCPMessagesServer ¶
type Tenvis_StreamSCPMessagesServer interface {
Send(*SCPMessages) error
grpc.ServerStream
}
type UnimplementedTenvisServer ¶
type UnimplementedTenvisServer struct {
}
UnimplementedTenvisServer can be embedded to have forward compatible implementations.
func (*UnimplementedTenvisServer) CreateVoting ¶
func (*UnimplementedTenvisServer) CreateVoting(ctx context.Context, req *CreateVotingOperation) (*Voting, error)
func (*UnimplementedTenvisServer) GetLedger ¶
func (*UnimplementedTenvisServer) GetLedger(ctx context.Context, req *GetLedgerRequest) (*LedgerMessage, error)
func (*UnimplementedTenvisServer) GetVoting ¶
func (*UnimplementedTenvisServer) GetVoting(ctx context.Context, req *GetVotingRequest) (*Voting, error)
func (*UnimplementedTenvisServer) StreamSCPMessages ¶
func (*UnimplementedTenvisServer) StreamSCPMessages(req *empty.Empty, srv Tenvis_StreamSCPMessagesServer) error
func (*UnimplementedTenvisServer) Vote ¶
func (*UnimplementedTenvisServer) Vote(ctx context.Context, req *VoteOperation) (*Voting, error)
type VoteOperation ¶
type VoteOperation struct {
ParticipantId string `protobuf:"bytes,1,opt,name=participant_id,json=participantId,proto3" json:"participant_id,omitempty"`
VotingId uint64 `protobuf:"varint,2,opt,name=voting_id,json=votingId,proto3" json:"voting_id,omitempty"`
Option string `protobuf:"bytes,3,opt,name=option,proto3" json:"option,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 (*VoteOperation) Descriptor ¶
func (*VoteOperation) Descriptor() ([]byte, []int)
func (*VoteOperation) GetOption ¶
func (m *VoteOperation) GetOption() string
func (*VoteOperation) GetParticipantId ¶
func (m *VoteOperation) GetParticipantId() string
func (*VoteOperation) GetSignature ¶
func (m *VoteOperation) GetSignature() []byte
func (*VoteOperation) GetVotingId ¶
func (m *VoteOperation) GetVotingId() uint64
func (*VoteOperation) ProtoMessage ¶
func (*VoteOperation) ProtoMessage()
func (*VoteOperation) Reset ¶
func (m *VoteOperation) Reset()
func (*VoteOperation) String ¶
func (m *VoteOperation) String() string
func (*VoteOperation) XXX_DiscardUnknown ¶
func (m *VoteOperation) XXX_DiscardUnknown()
func (*VoteOperation) XXX_Marshal ¶
func (m *VoteOperation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*VoteOperation) XXX_Merge ¶
func (m *VoteOperation) XXX_Merge(src proto.Message)
func (*VoteOperation) XXX_Size ¶
func (m *VoteOperation) XXX_Size() int
func (*VoteOperation) XXX_Unmarshal ¶
func (m *VoteOperation) XXX_Unmarshal(b []byte) error
type Voting ¶
type Voting struct {
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
Organizer string `protobuf:"bytes,3,opt,name=organizer,proto3" json:"organizer,omitempty"`
Participants []string `protobuf:"bytes,4,rep,name=participants,proto3" json:"participants,omitempty"`
Voted []string `protobuf:"bytes,5,rep,name=voted,proto3" json:"voted,omitempty"`
Options map[string]uint32 `` /* 156-byte string literal not displayed */
Result string `protobuf:"bytes,7,opt,name=result,proto3" json:"result,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (*Voting) Descriptor ¶
func (*Voting) GetOptions ¶
func (*Voting) GetOrganizer ¶
func (*Voting) GetParticipants ¶
func (*Voting) ProtoMessage ¶
func (*Voting) ProtoMessage()
func (*Voting) XXX_DiscardUnknown ¶
func (m *Voting) XXX_DiscardUnknown()