server

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = errors.New("Not supported")

Functions

This section is empty.

Types

type Config

type Config struct {
	DB                   db.Config        `yaml:"db"`
	Port                 int              `yaml:"port"`
	HttpPort             int              `yaml:"httpPort"`
	Committee            committee.Config `yaml:"committee"`
	SelfStakingThreshold string           `yaml:"selfStakingThreshold"`
	ScoreThreshold       string           `yaml:"scoreThreshold"`
}

Config defines the config for server

type DummyServer added in v0.2.14

type DummyServer interface {
	api.APIServiceServer
	Start(context.Context) error
	Stop(context.Context) error
}

DummyServer defines the interface of the ranking dummy server implementation

func NewDummyServer added in v0.2.14

func NewDummyServer(port int, httpPort int) (DummyServer, error)

NewDummyServer returns an implementation of ranking dummy server

type MixConfig added in v0.2.14

type MixConfig struct {
	ElectionConfig      Config              `yaml:"electionConfig"`
	NativeConfig        NativeStakingConfig `yaml:"nativeConfig"`
	VoteSync            votesync.Config     `yaml:"voteSync"`
	EnableVoteSync      bool                `yaml:"enableVoteSync"`
	DummyServerPort     int                 `yaml:"dummyServerPort"`
	DummyServerHttpPort int                 `yaml:"dummyServerHttpPort"`
}

type NativeStakingConfig added in v0.2.14

type NativeStakingConfig struct {
	DB        db.Config                       `yaml:"db"`
	Port      int                             `yaml:"port"`
	Committee committee.NativeCommitteeConfig `yaml:"committee"`
}

NativeStakingConfig defines the config for native staking server

type NativeStakingServer added in v0.2.14

type NativeStakingServer struct {
	api.APIServiceServer
	// contains filtered or unexported fields
}

NativeStakingServer implements api.APIServiceServer.

func NewNativeStakingServer added in v0.2.14

func NewNativeStakingServer(cfg *NativeStakingConfig) (*NativeStakingServer, error)

NewNativeStakingServer returns an implementation of ranking server

func (*NativeStakingServer) Committee added in v0.2.14

func (*NativeStakingServer) GetBuckets added in v0.2.14

GetBuckets returns a list of buckets

func (*NativeStakingServer) GetBucketsByCandidate added in v0.2.14

func (s *NativeStakingServer) GetBucketsByCandidate(ctx context.Context, request *api.GetBucketsByCandidateRequest) (*api.BucketResponse, error)

GetBucketsByCandidate returns the buckets

func (*NativeStakingServer) GetCandidateByName added in v0.2.14

func (s *NativeStakingServer) GetCandidateByName(ctx context.Context, request *api.GetCandidateByNameRequest) (*api.Candidate, error)

GetCandidateByName returns the candidate details

func (*NativeStakingServer) GetCandidates added in v0.2.14

GetCandidates returns a list of candidates sorted by weighted votes

func (*NativeStakingServer) GetMeta added in v0.2.14

func (s *NativeStakingServer) GetMeta(ctx context.Context, empty *empty.Empty) (*api.ChainMeta, error)

GetMeta returns the meta of the chain

func (*NativeStakingServer) GetRawData added in v0.2.14

func (*NativeStakingServer) IsHealth added in v0.2.14

func (*NativeStakingServer) Start added in v0.2.14

func (s *NativeStakingServer) Start(ctx context.Context) error

func (*NativeStakingServer) Stop added in v0.2.14

type Server

type Server interface {
	api.APIServiceServer
	Start(context.Context) error
	Stop(context.Context) error
}

Server defines the interface of the ranking server implementation

func NewServer

func NewServer(cfg *Config, vs *votesync.VoteSync) (Server, error)

NewServer returns an implementation of ranking server

type ServerMix added in v0.2.14

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

func NewServerMix added in v0.2.14

func NewServerMix(mCfg MixConfig) (*ServerMix, error)

func (*ServerMix) Start added in v0.2.14

func (sm *ServerMix) Start(ctx context.Context) error

func (*ServerMix) Stop added in v0.2.14

func (sm *ServerMix) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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