server

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 32 Imported by: 1

Documentation

Index

Constants

View Source
const KeyEnvVar = "POET_PRIVATE_KEY"

Environment variable name for the private key. Should be set to a base64-encoded ed25519 private key.

Variables

This section is empty.

Functions

func SetupConfig added in v0.9.2

func SetupConfig(cfg *Config)

SetupConfig adjusts the paths in the config to be relative to the poetdir.

Types

type Config added in v0.9.2

type Config struct {
	Genesis         Genesis `long:"genesis-time"       description:"Genesis timestamp in RFC3339 format"`
	PoetDir         string  `long:"poetdir"            description:"The base directory that contains poet's data, logs, configuration file, etc."`
	ConfigFile      string  `` /* 126-byte string literal not displayed */
	DataDir         string  `` /* 126-byte string literal not displayed */
	DbDir           string  `long:"dbdir"              description:"The directory to store DBs within"`
	LogDir          string  `long:"logdir"             description:"Directory to log output."`
	DebugLog        bool    `long:"debuglog"           description:"Enable debug logs"`
	JSONLog         bool    `long:"jsonlog"            description:"Whether to log in JSON format"`
	MaxLogFiles     int     `long:"maxlogfiles"        description:"Maximum logfiles to keep (0 for no rotation)"`
	MaxLogFileSize  int     `long:"maxlogfilesize"     description:"Maximum logfile size in MB"`
	RawRPCListener  string  `` /* 126-byte string literal not displayed */
	RawRESTListener string  `` /* 126-byte string literal not displayed */
	MetricsPort     *uint16 `long:"metrics-port"       description:"The port to expose metrics"`
	MaxGrpcRespSize int     `long:"max-grpc-resp-size" description:"Maximum size of GRPC response in bytes"`

	CPUProfile string `long:"cpuprofile" description:"Write CPU profile to the specified file"`
	Profile    string `long:"profile"    description:"Enable HTTP profiling on given port -- must be between 1024 and 65535"`

	Round        *RoundConfig        `group:"Round"`
	Registration registration.Config `group:"Registration"`
	Service      service.Config      `group:"Service"`

	DisableWorker bool `long:"disable-worker" description:"Whether to disable worker service for PoSW"`
}

func DefaultConfig added in v0.9.2

func DefaultConfig() *Config

DefaultConfig returns a config with default hardcoded values.

func ParseFlags added in v0.9.2

func ParseFlags(preCfg *Config) (*Config, error)

ParseFlags reads values from command line arguments.

func ReadConfigFile added in v0.9.2

func ReadConfigFile(cfg *Config) (*Config, error)

ReadConfigFile reads config from an ini file. It uses the provided `cfg` as a base config and overrides it with the values from the config file.

type Genesis added in v0.9.2

type Genesis time.Time

func (Genesis) Time added in v0.9.2

func (g Genesis) Time() time.Time

func (*Genesis) UnmarshalFlag added in v0.9.2

func (g *Genesis) UnmarshalFlag(value string) error

UnmarshalFlag implements flags.Unmarshaler.

type RoundConfig added in v0.9.2

type RoundConfig struct {
	EpochDuration time.Duration `long:"epoch-duration" description:"Epoch duration"`
	PhaseShift    time.Duration `long:"phase-shift"`
	CycleGap      time.Duration `long:"cycle-gap"`
}

func DefaultRoundConfig added in v0.9.2

func DefaultRoundConfig() *RoundConfig

func (RoundConfig) MarshalLogObject added in v0.9.2

func (c RoundConfig) MarshalLogObject(enc zapcore.ObjectEncoder) error

implement zap.ObjectMarshaler interface.

func (*RoundConfig) OpenRoundId added in v0.9.2

func (c *RoundConfig) OpenRoundId(genesis, when time.Time) uint

Calculate ID of the open round at a given point in time.

func (*RoundConfig) RoundDuration added in v0.9.2

func (c *RoundConfig) RoundDuration() time.Duration

func (*RoundConfig) RoundEnd added in v0.9.2

func (c *RoundConfig) RoundEnd(genesis time.Time, epoch uint) time.Time

func (*RoundConfig) RoundStart added in v0.9.2

func (c *RoundConfig) RoundStart(genesis time.Time, epoch uint) time.Time

type Server added in v0.4.0

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

func New added in v0.4.0

func New(ctx context.Context, cfg Config) (*Server, error)

func (*Server) Close added in v0.4.0

func (s *Server) Close() error

func (*Server) GrpcAddr added in v0.6.4

func (s *Server) GrpcAddr() net.Addr

GrpcAddr returns the address that server is listening on for GRPC.

func (*Server) GrpcRestProxyAddr added in v0.6.4

func (s *Server) GrpcRestProxyAddr() net.Addr

GrpcRestProxyAddr returns the address that REST-GRPC proxy is listening on.

func (*Server) PublicKey added in v0.10.2

func (s *Server) PublicKey() ed25519.PublicKey

func (*Server) Start added in v0.4.0

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

Start starts the RPC server.

Jump to

Keyboard shortcuts

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