http

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoJoinNodeRequest

func DoJoinNodeRequest(clusterAddress string, nodeID string, nodeAddress string, tlsConfig *tls.Config) error

Types

type Service

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

Service setups a HTTP service for forward data of raft node.

func NewService

func NewService(logger *zap.Logger, ln net.Listener, tlsConfig *tls.Config, store Store) (*Service, error)

NewService creates a Service.

func (*Service) Addr

func (s *Service) Addr() string

func (*Service) DoAddPolicyRequest

func (s *Service) DoAddPolicyRequest(request *command.AddPoliciesRequest) error

func (*Service) DoClearPolicyRequest

func (s *Service) DoClearPolicyRequest() error

func (*Service) DoJoinNodeRequest

func (s *Service) DoJoinNodeRequest(request *command.AddNodeRequest) error

func (*Service) DoRemoveFilteredPolicyRequest

func (s *Service) DoRemoveFilteredPolicyRequest(request *command.RemoveFilteredPolicyRequest) error

func (*Service) DoRemoveNodeRequest

func (s *Service) DoRemoveNodeRequest(request *command.RemoveNodeRequest) error

func (*Service) DoRemovePolicyRequest

func (s *Service) DoRemovePolicyRequest(request *command.RemovePoliciesRequest) error

func (*Service) DoUpdateFilteredPoliciesRequest added in v0.0.13

func (s *Service) DoUpdateFilteredPoliciesRequest(request *command.UpdateFilteredPoliciesRequest) error

func (*Service) DoUpdatePoliciesRequest

func (s *Service) DoUpdatePoliciesRequest(request *command.UpdatePoliciesRequest) error

func (*Service) DoUpdatePolicyRequest

func (s *Service) DoUpdatePolicyRequest(request *command.UpdatePolicyRequest) error

func (*Service) GetScheme added in v0.0.4

func (s *Service) GetScheme() string

func (*Service) Start

func (s *Service) Start() error

Start starts this service. It always returns a non-nil error. After Shutdown or Close, the returned error is http.ErrServerClosed.

func (*Service) Stop

func (s *Service) Stop(ctx context.Context) error

Stop stops this service.

type Store

type Store interface {
	// AddPolicies adds a set of rules to the current policy.
	AddPolicies(request *command.AddPoliciesRequest) error
	// RemovePolicies removes a set of rules from the current policy.
	RemovePolicies(request *command.RemovePoliciesRequest) error
	// RemoveFilteredPolicy removes a set of rules that match a pattern from the current policy.
	RemoveFilteredPolicy(request *command.RemoveFilteredPolicyRequest) error
	// UpdatePolicy updates a rule of policy.
	UpdatePolicy(request *command.UpdatePolicyRequest) error
	// UpdatePolicies updates a set of rules of policy.
	UpdatePolicies(request *command.UpdatePoliciesRequest) error
	// UpdateFilteredPolicies updates a set of rules of policy.
	UpdateFilteredPolicies(request *command.UpdateFilteredPoliciesRequest) error
	// ClearPolicy clears all policies.
	ClearPolicy() error

	// JoinNode joins a node with a given serverID and network address to cluster.
	JoinNode(serverID string, address string) error
	// RemoveNode removes a node with a given serverID from cluster.
	RemoveNode(serverID string) error
	// Leader checks if it is a leader and returns network address.
	Leader() (bool, string)

	// Stats returns stats.
	Stats() (map[string]interface{}, error)
}

Store provides an interface that can be implemented by raft.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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