client

package
v0.0.0-...-3680e65 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlphaRPCsCache

type AlphaRPCsCache struct {
	// contains filtered or unexported fields
}

func NewAlphaRPCsCache

func NewAlphaRPCsCache(bootstraps []string) AlphaRPCsCache

func (*AlphaRPCsCache) Get

func (arc *AlphaRPCsCache) Get() []*spb.BFTRaftClient

func (*AlphaRPCsCache) ResetBootstrap

func (arc *AlphaRPCsCache) ResetBootstrap(addrs []string)

type BFTRaftClient

type BFTRaftClient struct {
	Id          uint64
	PrivateKey  *rsa.PrivateKey
	AlphaRPCs   AlphaRPCsCache
	GroupHosts  *cache.Cache
	GroupLeader *cache.Cache
	CmdResChan  map[uint64]map[uint64]chan []byte
	Counter     int64
	Lock        sync.RWMutex
}

func NewClient

func NewClient(bootstraps []string, opts ClientOptions) (*BFTRaftClient, error)

bootstraps is a list of server address believed to be the member of the network the list does not need to contain alpha nodes since all of the nodes on the network will get informed

func (*BFTRaftClient) ExecCommand

func (brc *BFTRaftClient) ExecCommand(groupId uint64, funcId uint64, arg []byte) (*[]byte, error)

func (*BFTRaftClient) GetGroupHosts

func (brc *BFTRaftClient) GetGroupHosts(groupId uint64) *[]*spb.Host

func (*BFTRaftClient) GetGroupLeader

func (brc *BFTRaftClient) GetGroupLeader(groupId uint64) spb.BFTRaftClient

func (*BFTRaftClient) GroupExists

func (brc *BFTRaftClient) GroupExists(groupId uint64) bool

type ClientOptions

type ClientOptions struct {
	PrivateKey []byte
}

type FeedbackServer

type FeedbackServer struct {
	ClientIns *BFTRaftClient
}

func (*FeedbackServer) ResponseCommand

func (fs *FeedbackServer) ResponseCommand(ctx context.Context, cmd *pb.CommandResult) (*pb.Nothing, error)

Jump to

Keyboard shortcuts

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