Documentation ¶
Index ¶
- Constants
- func PrecommitBlockALL(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func PrecommitBlockCoordinator(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, ...) (interface{}, error)
- func PrecommitOneFollowerFail(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func WhiteListChecker(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func WithBadgerDB(path string) func(*Server) error
- type Coordinator
- type Option
- type Server
- func (s *Server) Commit(ctx context.Context, req *proto.CommitRequest) (*proto.Response, error)
- func (s *Server) Get(ctx context.Context, req *proto.Msg) (*proto.Value, error)
- func (s *Server) NodeInfo(ctx context.Context, req *empty.Empty) (*proto.Info, error)
- func (s *Server) Precommit(ctx context.Context, req *proto.PrecommitRequest) (*proto.Response, error)
- func (s *Server) Propose(ctx context.Context, req *proto.ProposeRequest) (*proto.Response, error)
- func (s *Server) Put(ctx context.Context, req *proto.Entry) (*proto.Response, error)
- func (s *Server) Run(opts ...grpc.UnaryServerInterceptor)
- func (s *Server) Stop()
Constants ¶
View Source
const ( TWO_PHASE = "two-phase" THREE_PHASE = "three-phase" )
Variables ¶
This section is empty.
Functions ¶
func PrecommitBlockALL ¶
func PrecommitBlockALL(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
PrecommitBlock blocks execution of all followers on precommit stage for 10s
func PrecommitBlockCoordinator ¶
func PrecommitBlockCoordinator(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
PrecommitBlockCoordinator blocks execution of coordinator on precommit stage for 1s
func PrecommitOneFollowerFail ¶
func PrecommitOneFollowerFail(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
func WhiteListChecker ¶
func WhiteListChecker(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
WhiteListChecker intercepts RPC and checks that the caller is whitelisted.
func WithBadgerDB ¶
WithBadgerDB adds BadgerDB manager to the Server instance
Types ¶
type Coordinator ¶
type Coordinator interface { Broadcast(ctx context.Context, req entity.BroadcastRequest) (*entity.BroadcastResponse, error) Height() uint64 }
type Server ¶
type Server struct { proto.UnimplementedCommitServer Addr string GRPCServer *grpc.Server DB db.Repository DBPath string ProposeHook func(req *proto.ProposeRequest) bool CommitHook func(req *proto.CommitRequest) bool Tracer *zipkin.Tracer Config *config.Config // contains filtered or unexported fields }
Server holds server instance, node config and connections to followers (if it's a coordinator node)
func New ¶
func New(conf *config.Config, tracer *zipkin.Tracer, cohort cohort.Cohort, coordinator Coordinator, database db.Repository, opts ...Option) (*Server, error)
New fabric func for Server
func (*Server) Run ¶
func (s *Server) Run(opts ...grpc.UnaryServerInterceptor)
Run starts non-blocking GRPC server
Click to show internal directories.
Click to hide internal directories.