byzantine

package module
v0.0.0-...-0cc5cf2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2017 License: MIT Imports: 12 Imported by: 0

README

Byzantine

license GoDoc Go Report Card

This is an implementation of the Byzantine Fault Tolerance algorithm as modelled by Eric Scott Freeman with gRPC for Go.

Generating Changes

To generate changes with protoc:

protoc -I/usr/local/include -I. \
     -I$GOPATH/src \
     -I$GOPATH/src/github.com/googleapis/googleapis/ \
     -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
     --go_out=,plugins=grpc:. \
     --swagger_out=logtostderr=true:. \
     --grpc-gateway_out=logtostderr=true:. \
     byzantine.proto

Documentation

Overview

Package byzantine is a generated protocol buffer package.

It is generated from these files:

byzantine.proto

It has these top-level messages:

Publication
Publisher
Subscriber
PubResponse
SubRequest
ChainMAC
ChainResponse
EchoResponse
ReadyResponse

Package byzantine is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterBrokerHandler

func RegisterBrokerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterBrokerHandler registers the http handlers for service Broker to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterBrokerHandlerFromEndpoint

func RegisterBrokerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterBrokerHandlerFromEndpoint is same as RegisterBrokerHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterBrokerServer

func RegisterBrokerServer(s *grpc.Server, srv BrokerServer)

func RegisterSubscribeHandler

func RegisterSubscribeHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterSubscribeHandler registers the http handlers for service Subscribe to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterSubscribeHandlerFromEndpoint

func RegisterSubscribeHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterSubscribeHandlerFromEndpoint is same as RegisterSubscribeHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterSubscribeServer

func RegisterSubscribeServer(s *grpc.Server, srv SubscribeServer)

Types

type BrokerClient

type BrokerClient interface {
	Echo(ctx context.Context, in *Publication, opts ...grpc.CallOption) (*EchoResponse, error)
	GetSubscribers(ctx context.Context, in *Subscriber, opts ...grpc.CallOption) (Broker_GetSubscribersClient, error)
	RegisterSubscriber(ctx context.Context, in *Subscriber, opts ...grpc.CallOption) (*ReadyResponse, error)
	Ready(ctx context.Context, in *Publication, opts ...grpc.CallOption) (*ReadyResponse, error)
	Receive(ctx context.Context, in *Publication, opts ...grpc.CallOption) (*PubResponse, error)
	Push(ctx context.Context, opts ...grpc.CallOption) (Broker_PushClient, error)
	Chain(ctx context.Context, in *Publication, opts ...grpc.CallOption) (*ChainResponse, error)
}

func NewBrokerClient

func NewBrokerClient(cc *grpc.ClientConn) BrokerClient

type Broker_GetSubscribersClient

type Broker_GetSubscribersClient interface {
	Recv() (*Subscriber, error)
	grpc.ClientStream
}

type Broker_GetSubscribersServer

type Broker_GetSubscribersServer interface {
	Send(*Subscriber) error
	grpc.ServerStream
}

type Broker_PushClient

type Broker_PushClient interface {
	Send(*SubRequest) error
	Recv() (*Publication, error)
	grpc.ClientStream
}

type Broker_PushServer

type Broker_PushServer interface {
	Send(*Publication) error
	Recv() (*SubRequest, error)
	grpc.ServerStream
}

type ChainMAC

type ChainMAC struct {
	From string `protobuf:"bytes,1,opt,name=From" json:"From,omitempty"`
	To   string `protobuf:"bytes,2,opt,name=To" json:"To,omitempty"`
	MAC  []byte `protobuf:"bytes,3,opt,name=MAC,proto3" json:"MAC,omitempty"`
}

func (*ChainMAC) Descriptor

func (*ChainMAC) Descriptor() ([]byte, []int)

func (*ChainMAC) GetFrom

func (m *ChainMAC) GetFrom() string

func (*ChainMAC) GetMAC

func (m *ChainMAC) GetMAC() []byte

func (*ChainMAC) GetTo

func (m *ChainMAC) GetTo() string

func (*ChainMAC) ProtoMessage

func (*ChainMAC) ProtoMessage()

func (*ChainMAC) Reset

func (m *ChainMAC) Reset()

func (*ChainMAC) String

func (m *ChainMAC) String() string

type ChainResponse

type ChainResponse struct {
	Valid bool `protobuf:"varint,1,opt,name=Valid" json:"Valid,omitempty"`
}

func (*ChainResponse) Descriptor

func (*ChainResponse) Descriptor() ([]byte, []int)

func (*ChainResponse) GetValid

func (m *ChainResponse) GetValid() bool

func (*ChainResponse) ProtoMessage

func (*ChainResponse) ProtoMessage()

func (*ChainResponse) Reset

func (m *ChainResponse) Reset()

func (*ChainResponse) String

func (m *ChainResponse) String() string

type EchoResponse

type EchoResponse struct {
	Hello bool `protobuf:"varint,1,opt,name=Hello" json:"Hello,omitempty"`
}

func (*EchoResponse) Descriptor

func (*EchoResponse) Descriptor() ([]byte, []int)

func (*EchoResponse) GetHello

func (m *EchoResponse) GetHello() bool

func (*EchoResponse) ProtoMessage

func (*EchoResponse) ProtoMessage()

func (*EchoResponse) Reset

func (m *EchoResponse) Reset()

func (*EchoResponse) String

func (m *EchoResponse) String() string

type PubResponse

type PubResponse struct {
	Success bool `protobuf:"varint,1,opt,name=Success" json:"Success,omitempty"`
}

func (*PubResponse) Descriptor

func (*PubResponse) Descriptor() ([]byte, []int)

func (*PubResponse) GetSuccess

func (m *PubResponse) GetSuccess() bool

func (*PubResponse) ProtoMessage

func (*PubResponse) ProtoMessage()

func (*PubResponse) Reset

func (m *PubResponse) Reset()

func (*PubResponse) String

func (m *PubResponse) String() string

type Publication

type Publication struct {
	PubType       uint32      `protobuf:"varint,1,opt,name=PubType" json:"PubType,omitempty"`
	PublisherID   uint64      `protobuf:"varint,2,opt,name=PublisherID" json:"PublisherID,omitempty"`
	PublicationID int64       `protobuf:"zigzag64,3,opt,name=PublicationID" json:"PublicationID,omitempty"`
	TopicID       uint64      `protobuf:"varint,4,opt,name=TopicID" json:"TopicID,omitempty"`
	BrokerID      uint64      `protobuf:"varint,5,opt,name=BrokerID" json:"BrokerID,omitempty"`
	Contents      [][]byte    `protobuf:"bytes,6,rep,name=Contents,proto3" json:"Contents,omitempty"`
	MAC           []byte      `protobuf:"bytes,7,opt,name=MAC,proto3" json:"MAC,omitempty"`
	ChainMACs     []*ChainMAC `protobuf:"bytes,8,rep,name=ChainMACs" json:"ChainMACs,omitempty"`
}

/ Publication is the message sent out to the brokers, who pass it along to the subscribers.

func (*Publication) Descriptor

func (*Publication) Descriptor() ([]byte, []int)

func (*Publication) GetBrokerID

func (m *Publication) GetBrokerID() uint64

func (*Publication) GetChainMACs

func (m *Publication) GetChainMACs() []*ChainMAC

func (*Publication) GetContents

func (m *Publication) GetContents() [][]byte

func (*Publication) GetMAC

func (m *Publication) GetMAC() []byte

func (*Publication) GetPubType

func (m *Publication) GetPubType() uint32

func (*Publication) GetPublicationID

func (m *Publication) GetPublicationID() int64

func (*Publication) GetPublisherID

func (m *Publication) GetPublisherID() uint64

func (*Publication) GetTopicID

func (m *Publication) GetTopicID() uint64

func (*Publication) ProtoMessage

func (*Publication) ProtoMessage()

func (*Publication) Reset

func (m *Publication) Reset()

func (*Publication) String

func (m *Publication) String() string

type Publisher

type Publisher struct {
	Address     string `protobuf:"bytes,1,opt,name=Address" json:"Address,omitempty"`
	PublisherID uint64 `protobuf:"varint,2,opt,name=PublisherID" json:"PublisherID,omitempty"`
}

/ Publisher defines a publisher within a quorum.

func (*Publisher) Descriptor

func (*Publisher) Descriptor() ([]byte, []int)

func (*Publisher) GetAddress

func (m *Publisher) GetAddress() string

func (*Publisher) GetPublisherID

func (m *Publisher) GetPublisherID() uint64

func (*Publisher) ProtoMessage

func (*Publisher) ProtoMessage()

func (*Publisher) Reset

func (m *Publisher) Reset()

func (*Publisher) String

func (m *Publisher) String() string

type ReadyResponse

type ReadyResponse struct {
	Ready bool `protobuf:"varint,1,opt,name=Ready" json:"Ready,omitempty"`
}

func (*ReadyResponse) Descriptor

func (*ReadyResponse) Descriptor() ([]byte, []int)

func (*ReadyResponse) GetReady

func (m *ReadyResponse) GetReady() bool

func (*ReadyResponse) ProtoMessage

func (*ReadyResponse) ProtoMessage()

func (*ReadyResponse) Reset

func (m *ReadyResponse) Reset()

func (*ReadyResponse) String

func (m *ReadyResponse) String() string

type SubRequest

type SubRequest struct {
	PublisherID uint64 `protobuf:"varint,1,opt,name=PublisherID" json:"PublisherID,omitempty"`
	BrokerID    uint64 `protobuf:"varint,2,opt,name=BrokerID" json:"BrokerID,omitempty"`
}

func (*SubRequest) Descriptor

func (*SubRequest) Descriptor() ([]byte, []int)

func (*SubRequest) GetBrokerID

func (m *SubRequest) GetBrokerID() uint64

func (*SubRequest) GetPublisherID

func (m *SubRequest) GetPublisherID() uint64

func (*SubRequest) ProtoMessage

func (*SubRequest) ProtoMessage()

func (*SubRequest) Reset

func (m *SubRequest) Reset()

func (*SubRequest) String

func (m *SubRequest) String() string

type SubscribeClient

type SubscribeClient interface {
	Subscribe(ctx context.Context, in *SubRequest, opts ...grpc.CallOption) (*ReadyResponse, error)
}

func NewSubscribeClient

func NewSubscribeClient(cc *grpc.ClientConn) SubscribeClient

type SubscribeServer

type SubscribeServer interface {
	Subscribe(context.Context, *SubRequest) (*ReadyResponse, error)
}

type Subscriber

type Subscriber struct {
	Address                    string `protobuf:"bytes,1,opt,name=Address" json:"Address,omitempty"`
	PoolID                     uint64 `protobuf:"varint,2,opt,name=PoolID" json:"PoolID,omitempty"`
	DestinationDistinguishment uint64 `protobuf:"varint,3,opt,name=DestinationDistinguishment" json:"DestinationDistinguishment,omitempty"`
}

/ Subscriber defines a subscriber within a subscriber pool.

func (*Subscriber) Descriptor

func (*Subscriber) Descriptor() ([]byte, []int)

func (*Subscriber) GetAddress

func (m *Subscriber) GetAddress() string

func (*Subscriber) GetDestinationDistinguishment

func (m *Subscriber) GetDestinationDistinguishment() uint64

func (*Subscriber) GetPoolID

func (m *Subscriber) GetPoolID() uint64

func (*Subscriber) ProtoMessage

func (*Subscriber) ProtoMessage()

func (*Subscriber) Reset

func (m *Subscriber) Reset()

func (*Subscriber) String

func (m *Subscriber) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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