Documentation ¶
Index ¶
- Constants
- Variables
- func LoadStoreRouter(ctx context.Context, cfg CLIConfig, log log.Logger) (store.IRouter, error)
- func ReadCommitmentMeta(r *http.Request) (commitments.CommitmentMeta, error)
- func ReadCommitmentMode(r *http.Request) (commitments.CommitmentMode, error)
- func ReadCommitmentVersion(r *http.Request, mode commitments.CommitmentMode) (byte, error)
- func WithLogging(handleFn func(http.ResponseWriter, *http.Request) error, log log.Logger) func(http.ResponseWriter, *http.Request)
- func WithMetrics(...) func(http.ResponseWriter, *http.Request) error
- type CLIConfig
- type Config
- type MetaError
- type Server
- func (svr *Server) Endpoint() string
- func (svr *Server) GetEigenDAStats() *store.Stats
- func (svr *Server) GetS3Stats() *store.Stats
- func (svr *Server) GetStoreStats(bt store.BackendType) (*store.Stats, error)
- func (svr *Server) HandleGet(w http.ResponseWriter, r *http.Request) (commitments.CommitmentMeta, error)
- func (svr *Server) HandlePut(w http.ResponseWriter, r *http.Request) (commitments.CommitmentMeta, error)
- func (svr *Server) Health(w http.ResponseWriter, _ *http.Request) error
- func (svr *Server) Port() int
- func (svr *Server) Start() error
- func (svr *Server) Stop() error
- func (svr *Server) WriteBadRequest(w http.ResponseWriter, err error)
- func (svr *Server) WriteInternalError(w http.ResponseWriter, err error)
- func (svr *Server) WriteNotFound(w http.ResponseWriter, err error)
- func (svr *Server) WriteResponse(w http.ResponseWriter, data []byte)
Constants ¶
const ( GetRoute = "/get/" PutRoute = "/put/" Put = "put" CommitmentModeKey = "commitment_mode" )
Variables ¶
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
func LoadStoreRouter ¶ added in v1.3.0
LoadStoreRouter ... creates storage backend clients and instruments them into a storage routing abstraction
func ReadCommitmentMeta ¶ added in v1.5.0
func ReadCommitmentMeta(r *http.Request) (commitments.CommitmentMeta, error)
Read both commitment mode and version
func ReadCommitmentMode ¶ added in v1.2.0
func ReadCommitmentMode(r *http.Request) (commitments.CommitmentMode, error)
func ReadCommitmentVersion ¶ added in v1.5.0
func ReadCommitmentVersion(r *http.Request, mode commitments.CommitmentMode) (byte, error)
func WithLogging ¶
func WithLogging( handleFn func(http.ResponseWriter, *http.Request) error, log log.Logger, ) func(http.ResponseWriter, *http.Request)
WithLogging is a middleware that logs the request method and URL.
func WithMetrics ¶
func WithMetrics( handleFn func(http.ResponseWriter, *http.Request) (commitments.CommitmentMeta, error), m metrics.Metricer, ) func(http.ResponseWriter, *http.Request) error
WithMetrics is a middleware that records metrics for the route path.
Types ¶
type CLIConfig ¶
func ReadCLIConfig ¶
func ReadCLIConfig(ctx *cli.Context) CLIConfig
type Config ¶ added in v1.2.0
type Config struct { EdaClientConfig clients.EigenDAClientConfig VerifierConfig verify.Config MemstoreEnabled bool MemstoreConfig memstore.Config // routing FallbackTargets []string CacheTargets []string // secondary storage RedisConfig redis.Config S3Config s3.Config }
func ReadConfig ¶ added in v1.2.0
func ReadConfig(ctx *cli.Context) Config
ReadConfig ... parses the Config from the provided flags or environment variables.
type MetaError ¶ added in v1.5.0
type MetaError struct { Err error Meta commitments.CommitmentMeta }
MetaError includes both an error and commitment metadata
func NewMetaError ¶ added in v1.5.0
func NewMetaError(err error, meta commitments.CommitmentMeta) MetaError
NewMetaError creates a new MetaError
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) GetEigenDAStats ¶ added in v1.4.1
func (*Server) GetS3Stats ¶ added in v1.3.0
func (*Server) GetStoreStats ¶ added in v1.5.0
func (*Server) HandleGet ¶
func (svr *Server) HandleGet(w http.ResponseWriter, r *http.Request) (commitments.CommitmentMeta, error)
HandleGet handles the GET request for commitments. Note: even when an error is returned, the commitment meta is still returned, because it is needed for metrics (see the WithMetrics middleware). TODO: we should change this behavior and instead use a custom error that contains the commitment meta.
func (*Server) HandlePut ¶
func (svr *Server) HandlePut(w http.ResponseWriter, r *http.Request) (commitments.CommitmentMeta, error)
HandlePut handles the PUT request for commitments. Note: even when an error is returned, the commitment meta is still returned, because it is needed for metrics (see the WithMetrics middleware). TODO: we should change this behavior and instead use a custom error that contains the commitment meta.
func (*Server) WriteBadRequest ¶
func (svr *Server) WriteBadRequest(w http.ResponseWriter, err error)
func (*Server) WriteInternalError ¶
func (svr *Server) WriteInternalError(w http.ResponseWriter, err error)
func (*Server) WriteNotFound ¶
func (svr *Server) WriteNotFound(w http.ResponseWriter, err error)
func (*Server) WriteResponse ¶
func (svr *Server) WriteResponse(w http.ResponseWriter, data []byte)