api

package
v0.0.0-...-cd2fe80 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StandardHTTPHeaders = map[string]string{
	"Cache-Control":          "max-age=30, s-maxage=30, public",
	"Cache-Control-Tiny":     "max-age=1, s-maxage=1, public",
	"Cache-Control-Short":    "max-age=10, s-maxage=10, public",
	"Cache-Control-Medium":   "max-age=60, s-maxage=60, public",
	"Cache-Control-Long":     "max-age=300, s-maxage=300, public",
	"Cache-Control-VeryLong": "max-age=3600, s-maxage=3600, public",
}

StandardHTTPHeaders defines common HTTP headers that can be set on responses

Functions

This section is empty.

Types

type Config

type Config struct {
	LogLevel   string           `yaml:"logLevel" default:"info"`
	HttpServer HttpServerConfig `yaml:"httpServer"`
	Cache      *cache.Config    `yaml:"cache"`
	Storage    *storage.Config  `yaml:"storage"`
	SrvClient  *SrvClientConfig `yaml:"srvClient"`
}

Config contains the configuration for the API service

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the Config

type HttpServerConfig

type HttpServerConfig struct {
	Host           string   `yaml:"host"`
	Port           int      `yaml:"port"`
	PathPrefix     string   `yaml:"pathPrefix" default:"/lab-data"`
	CORSAllowAll   bool     `yaml:"corsAllowAll" default:"true"`
	AllowedOrigins []string `yaml:"allowedOrigins"`
}

HttpServerConfig contains the configuration for the HTTP server

type LabAPIServerImpl

type LabAPIServerImpl struct {
	apipb.LabAPIHandler
	// contains filtered or unexported fields
}

func NewLabAPIServer

func NewLabAPIServer(cacheClient cache.Client, storageClient storage.Client, srvConn *grpc.ClientConn, log logrus.FieldLogger) *LabAPIServerImpl

func (*LabAPIServerImpl) GetRecentLocallyBuiltBlocks

GetRecentLocallyBuiltBlocks retrieves recent locally built blocks for a network

type Service

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

Service represents the api service

func New

func New(config *Config) (*Service, error)

New creates a new api service

func (*Service) Start

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

Start starts the api service

type SrvClientConfig

type SrvClientConfig struct {
	Address string `yaml:"address"`
	TLS     bool   `yaml:"tls"`
}

func (*SrvClientConfig) Validate

func (c *SrvClientConfig) Validate() error

Validate validates the SrvClientConfig

Directories

Path Synopsis
v1

Jump to

Keyboard shortcuts

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